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

• Notes
• 33

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

Dynamic Dictionaries Primary Operations: get(key) => search put(key, element) => insert remove(key) => delete Additional operations: ascend() get(index) remove(index)

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

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
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

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

The Operation put() 20 10 6 2 8 15 40 30 25 Put a pair whose key is 35 . 35
The Operation remove() Three cases: Element is in a leaf. Element is in a degree 1 node. Element is in a degree 2 node.

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

Remove From A Leaf Remove a leaf element. key = 7 20 10 6 2 8 15 40 30 25 35 7 18
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

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

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
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

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

This is the end of the preview. Sign up to access the rest of the document.
• Spring '10
• sartajsahani
• NH, left subtree

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern