lec18 - Dynamic Dictionaries Primary Operations: get(key)...

Info iconThis preview shows pages 1–11. 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)
Background image of page 1

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

View Full DocumentRight 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
Background 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
Background image of page 3

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

View Full DocumentRight Arrow Icon
The Operation put() 20 10 6 2 8 15 40 30 25 Put a pair whose key is 35 . 35
Background 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.
Background image of page 5

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

View Full DocumentRight Arrow Icon
Remove From A Leaf Remove a leaf element. key = 7 20 10 6 2 8 15 40 30 25 35 7 18
Background 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
Background image of page 7

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

View Full DocumentRight 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
Background 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
Background image of page 9

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

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

This note was uploaded on 12/07/2010 for the course COT 5536 taught by Professor Sartajsahani during the Spring '10 term at University of Florida.

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 Right Arrow Icon
Ask a homework question - tutors are online