Download presentation
Presentation is loading. Please wait.
Published byKenneth Adams Modified over 9 years ago
1
1 Lecture 14: Queues Lecturer: Santokh Singh CompSci 105 SS 2005 Principles of Computer Science
2
2 Test Information on Course Web Page. See the “Test and Exams” Section. Please try not to be late for classes.
3
3 Tail References Beer Wine Milk head Textbook, pp. 186 tail What is the advantage of having a “tail”?
4
4 Linked Lists Inserting and Deleting Elements Implementing the ADT List Compared to Arrays Passing Linked Lists as Parameters Variations of the Linked List Tail References Circular Linked Lists Dummy Head Nodes
5
5 Circular Linked Lists Beer Wine Milk list (head) Textbook, pp. 187ff How do you get the first Node here if the external reference “list” shown above references the last Node? – pg 188.
6
6 Linked Lists Inserting and Deleting Elements Implementing the ADT List Compared to Arrays Passing Linked Lists as Parameters Variations of the Linked List Tail References Circular Linked Lists Dummy Head Nodes
7
7 Textbook, pp. 189ff Wine Milk head What is the advantage of having a Dummy Head?
8
8 List ADT Linked List Array
9
9 List ADT Linked List Array SortedList ADT Linked List Array
10
10 List ADT Linked List Array SortedList ADT Linked List Array Stack ADT Linked List Array List ADT
11
11 Stacks Basic ADT Operations Application: Undo Operations Application: Balancing Parenthesis Array Implementation Linked List Implementation Stack ADT implemented with List ADT
12
12 Undo Operations
13
13 Undo Operations
14
14 Stack ADT
15
15 Stack ADT Push Pop
16
16 Stack ADT void createStack ( ) void isEmpty ( ) void push ( Object newItem ) Object pop () void popAll () Object peek () Textbook, p. 252
17
17 Stacks Basic ADT Operations Application: Undo Operations Application: Balancing Parenthesis Array Implementation Linked List Implementation Stack ADT implemented with List ADT
18
18 Balancing Parenthesis ( a { b ( ) } ) { a [ b ( c ) d ( ) ) ] } Textbook, pp. 254ff
19
19 Stacks Basic ADT Operations Application: Undo Operations Application: Balancing Parenthesis Array Implementation Linked List Implementation Stack ADT implemented with List ADT
20
20 Array Implementation items: 153 2 top: 0123 4567 Java Code, Textbook, pp. 260ff
21
21 Stacks Basic ADT Operations Application: Undo Operations Application: Balancing Parenthesis Array Implementation Linked List Implementation Stack ADT implemented with List ADT
22
22 Linked List Implementation 1 5 3 top Java Code, Textbook, pp. 263ff
23
23 ADT List Implementation Java Code, Textbook, pp. 263ff 1. 1 2. 5 3. 3 4. 5. 6.
24
24 Queues Basic ADT Queue Operations "Circular" Array Implementation Linked List Implementation "Circular" Linked List Implementation Queue ADT implement with List ADT
25
25 Queue
26
26 Queue
27
27 Queue ADT void createQueue ( ) void isEmpty ( ) void enqueue ( Object newItem ) Object dequeue () void dequeueAll () Object peek () Textbook, p. 299
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.