12.07.2015 Views

A Practical Introduction to Data Structures and Algorithm Analysis

A Practical Introduction to Data Structures and Algorithm Analysis

A Practical Introduction to Data Structures and Algorithm Analysis

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

366 Chap. 10 IndexingFigure 10.7 Breaking the BST in<strong>to</strong> blocks. The BST is divided among diskblocks, each with space for three nodes. The path from the root <strong>to</strong> any leaf iscontained on two blocks.54372 62 4 6 1 3 5 7(a)(b)Figure 10.8 An attempt <strong>to</strong> re-balance a BST after insertion can be expensive.(a) A BST with six nodes in the shape of a complete binary tree. (b) A node withvalue 1 is inserted in<strong>to</strong> the BST of (a). To maintain both the complete binary treeshape <strong>and</strong> the BST property, a major reorganization of the tree is required.it naturally leads <strong>to</strong> the B-tree of Section 10.5, which is by far the most widely usedindexing method <strong>to</strong>day.10.4 2-3 TreesThis section presents a data structure called the 2-3 tree. The 2-3 tree is not a binarytree, but instead its shape obeys the following definition:1. A node contains one or two keys.2. Every internal node has either two children (if it contains one key) or threechildren (if it contains two keys). Hence the name.3. All leaves are at the same level in the tree, so the tree is always height balanced.In addition <strong>to</strong> these shape properties, the 2-3 tree has a search tree propertyanalogous <strong>to</strong> that of a BST. For every node, the values of all descendants in the leftsubtree are less than the value of the first key, while values in the center subtree

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!