Lecture_11_-_mix&match_-_3_slides_per_page_with_notes

Lecture_11_-_mix&match_-_3_slides_per_page_with_note...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
NUS CS1102 Data Structures with Multiple Organization NUS CS1102 Basic Data Structures box4 Array box4 Linked List box4 Trees The three basic building blocks for data structures are array, linked list and trees. We combine them to implement different data structures. NUS CS1102 Mix-and-Match 1 box4 Array of Linked-List 3 2 1 Array of linked list can implement a graph, or a hash table with separate chaining.
Image of page 1

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

View Full Document Right Arrow Icon
NUS CS1102 Mix-and-Match 2 box4 Binary Search Tree + Linked-List 5 4 8 7 1 3 9 2 You can have an augmented BST, where the successor pointer form a linked list. NUS CS1102 More Examples box4 Need an ADT for square6 enqueue(item) square6 dequeue(item) square6 peek() square6 printInOrder() Here is another example. Suppose we need an ADT that supports the operations of a queue plus printing the elements In some order. NUS CS1102 Use a Queue O(N log N) printInOrder () O(1) peek () O(1) dequeue () O(1) enqueue (item) If we use a queue, we can support the queue operation efficiently. But to print the items in order, we need to first sort the items in the queue, which is O(N log N) time.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern