CC2203-Les10Queue-for-viewing

CC2203-Les10Queue-for-viewing - Lesson 10: Queues Linear...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
10-1/31 Lesson 10: Queues • Linear list. • One end is called front. • Other end is called rear. • Additions are done at the rear only. • Removals are made from the front only.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10-2/31 Bus Stop Queue Bus Stop front rear rear rear rear rear
Background image of page 2
10-3/31 Bus Stop Queue Bus Stop front rear rear rear
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10-4/31 Bus Stop Queue Bus Stop front rear rear
Background image of page 4
10-5/31 Bus Stop Queue Bus Stop front rear rear
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10-6/31 The Interface Queue public interface Queue { public boolean isEmpty(); public Object getFrontEelement(); public Object getRearEelement(); public void put(Object theObject); public Object remove(); } demo: javac dataStructures\Queue.java
Background image of page 6
10-7/31 Derive From ExtendedChain a b c d e null firstNode lastNode front rear h when front is left end of list and rear is right end • Queue.isEmpty() => super.isEmpty() – O(1) time • getFrontElement() => get(0) – O(1) time show: dataStructures\Chain.java dataStructures\ExtendedChain.java
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10-8/31 Derive From ExtendedChain a b c d e null firstNode lastNode front rear • getRearElement() => getLast() … new method – O(1) time • put(theObject) => add(theObject) b append theObject – O(1) time • remove() => remove(0) – O(1) time
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 31

CC2203-Les10Queue-for-viewing - Lesson 10: Queues Linear...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online