24Trees-handouts-2

# 24Trees-handouts-2 - (2,4) Trees 1/22/2006 10:19 AM (2,4)...

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

(2,4) Trees 1/22/2006 10:19 AM 1 1/22/2006 10:19 AM (2,4) Trees 1 (2,4) Trees 9 10 14 2 5 7 1/22/2006 10:19 AM (2,4) Trees 2 Outline and Reading Multi-way search tree (§3.3.1) ± Definition ± Search (2,4) tree (§3.3.2) ± Definition ± Search ± Insertion ± Deletion Comparison of dictionary implementations

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

View Full Document
(2,4) Trees 1/22/2006 10:19 AM 2 1/22/2006 10:19 AM (2,4) Trees 3 Multi-Way Search Tree A multi-way search tree is an ordered tree such that ± Each internal node has at least two children and stores d 1 key-element items ( k i , o i ) , where d is the number of children ± For a node with children v 1 v 2 v d storing keys k 1 k 2 k d 1 ² keys in the subtree of v 1 are less than k 1 ² keys in the subtree of v i are between k i 1 and k i ( i = 2, …, d 1) ² keys in the subtree of v d are greater than k d 1 ± The leaves store no items and serve as placeholders 11 24 2 6 8 15 30 27 32 1/22/2006 10:19 AM (2,4) Trees 4 Multi-Way Inorder Traversal We can extend the notion of inorder traversal from binary trees to multi-way search trees Namely, we visit item ( k i , o i ) of node v between the recursive traversals of the subtrees of v rooted at children v i and v i + 1 An inorder traversal of a multi-way search tree visits the keys in increasing order 11 24 2 6 8 15 30 27 32 1357 9 1 1 1 3 1 9 15 17 2 4 6 14 18 81 2 10 16
(2,4) Trees 1/22/2006 10:19 AM 3 1/22/2006 10:19 AM (2,4) Trees 5 Multi-Way Searching Similar to search in a binary search tree A each internal node with children v 1 v 2 v d and keys k 1 k 2 k d 1 ± k = k i ( i = 1, …, d 1)

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## 24Trees-handouts-2 - (2,4) Trees 1/22/2006 10:19 AM (2,4)...

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

View Full Document
Ask a homework question - tutors are online