{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

24Trees

# 24Trees - (2,4 Trees 8:31 AM Outline and Reading Multi-way...

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

4/1/2003 8:31 AM (2,4) Trees 1 (2,4) Trees 9 10 14 2 5 7 4/1/2003 8:31 AM (2,4) Trees 2 Outline and Reading Multi-way search tree (§9.3) Definition Search (2,4) tree (§9.4) Definition Search Insertion Deletion Comparison of dictionary implementations 4/1/2003 8:31 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 4/1/2003 8:31 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 1 3 5 7 9 11 13 19 15 17 2 4 6 14 18 8 12 10 16 4/1/2003 8:31 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) : the search terminates successfully k < k 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.

{[ snackBarMessage ]}

### Page1 / 3

24Trees - (2,4 Trees 8:31 AM Outline and Reading Multi-way...

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

View Full Document
Ask a homework question - tutors are online