lec18 - Dynamic Dictionaries Primary Operations get(key =>...

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

View Full Document Right Arrow Icon
Dynamic Dictionaries Primary Operations: get(key) => search put(key, element) => insert remove(key) => delete Additional operations: ascend() get(index) remove(index)
Image of page 1

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

View Full Document Right Arrow Icon
Complexity Of Dictionary Operations get(), put() and remove() Data Structure Worst Case Expected Hash Table O(n) O(1) Binary Search Tree O(n) O(log n) Balanced Binary Search Tree O(log n) O(log n) n is number of elements in dictionary
Image of page 2
Complexity Of Other Operations ascend(), get(index), remove(index) Data Structure ascend get and remove Hash Table O(D + n log n) O(D + n log n) Indexed BST O(n) O(n) Indexed Balanced BST O(n) O(log n) D is number of buckets
Image of page 3

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

View Full Document Right Arrow Icon
The Operation put() 20 10 6 2 8 15 40 30 25 Put a pair whose key is 35 . 35
Image of page 4
The Operation remove() Three cases: Element is in a leaf. Element is in a degree 1 node. Element is in a degree 2 node.
Image of page 5

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

View Full Document Right Arrow Icon
Remove From A Leaf Remove a leaf element. key = 7 20 10 6 2 8 15 40 30 25 35 7 18
Image of page 6
Remove From A Degree 1 Node Remove from a degree 1 node. key = 40 20 10 6 2 8 15 40 30 25 35 7 18
Image of page 7

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

View Full Document Right Arrow Icon
Remove From A Degree 1 Node (contd.) Remove from a degree 1 node. key = 15 20 10 6 2 8 15 40 30 25 35 7 18
Image of page 8
Remove From A Degree 2 Node Remove from a degree 2 node. key = 10 20 10 6 2 8 15 40 30 25 35 7 18
Image of page 9

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

View Full Document Right Arrow Icon
Image of page 10
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