{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

This preview shows pages 1–11. 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.

View Full Document
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.

View Full Document
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.

View Full Document
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.

View Full Document
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.

View Full Document
20 10 6 2 8 15 40 30 25 Replace with largest key in left subtree (or smallest in right subtree). 35
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 33

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

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

View Full Document
Ask a homework question - tutors are online