24Trees

24Trees - (2,4) Trees 4/1/2003 8:31 AM Outline and Reading...

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

View Full Document Right Arrow Icon
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 1357 9 1 1 1 3 1 9 15 17 246 1 4 1 8 81 2 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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/02/2012 for the course CS 251 taught by Professor Staff during the Fall '08 term at Purdue.

Page1 / 3

24Trees - (2,4) Trees 4/1/2003 8:31 AM Outline and Reading...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online