Lecture 12 - mix&match - 4 slides per page

Lecture 12 - mix&match - 4 slides per page - Data...

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

View Full Document Right Arrow Icon
1 NUS CS1102 Data Structures with Multiple Organization NUS CS1102 Basic Data Structures b Array b Linked List b Trees NUS CS1102 Mix-and-Match 1 b Array of Linked-List 3 2 1 NUS CS1102 Mix-and-Match 2 b Binary Search Tree + Linked-List 5 4 8 7 1 3 9 2
Background image of page 1

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

View Full Document Right Arrow Icon
2 NUS CS1102 More Examples b Need an ADT for s enqueue(item) s dequeue(item) s peek() s printInOrder() NUS CS1102 Use a Queue O(N log N) printInOrder () O(1) peek () O(1) dequeue () O(1) enqueue (item) NUS CS1102 Use a Sorted Linked List O(N) printInOrder () ? peek () ? dequeue () ? enqueue (item) NUS CS1102 Use both 3 5 8 9 8 3 9 5 Queue Sorted List
Background image of page 2
3 NUS CS1102 Enqueue(6) 3 5 8 9 8 3 9 5 Queue Sorted List 6 6 NUS CS1102 Dequeue() 3 5 8 9 8 3 9 5 Queue Sorted List 6 6 NUS CS1102 Use Queue and Linked List O(N) printInOrder () O(1) peek () O(N) dequeue () O(N) enqueue (item) NUS CS1102
Background image of page 3

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

View Full Document Right Arrow Icon
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 5

Lecture 12 - mix&match - 4 slides per page - Data...

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

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