{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# T9 - B-Tree COMP171 Tutorial 9 Deficiency of AVL Tree...

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

B + -Tree COMP171 Tutorial 9

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

View Full Document
Deficiency of AVL Tree Performs really bad when the data is too huge and cannot be put in the main memory Too much disk access if the data is stored in the disk Access on disk is much slower than access on main memory No. of disk access is proportional to the depth of AVL tree
Alternative Solution — M-ary Tree Every node has multiple children (M-ary means M branches) Depth decreases as branching increases Depth = O(log M n) instead of O(log 2 n) Therefore, no. of disk access also decreases

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

View Full Document
B+-Tree — Basic Information An M-ary tree (M>3) Leaves contain data items all are at the same depth each node has L/2 to L data (usually L << M in practice) Internal nodes contain searching keys each node has M/2 to M children each node has (M/2)-1 to (M-1) searching keys key i is the smallest key in subtree i+1 Root can be a single leaf, or has 2 to M children
B+-Tree — Example M = L = 4 Records are at the leaves Node are at least half-full, so that the tree will not degenerate into simple binary tree or even link list Left child pointer & right child pointer and also left subtree & right subtree are defined left child of J right child of J left subtree of J right subtree of J

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

View Full Document
B+-Tree — In Practical Each internal node & leaf has the size of one I/O block of data minimize tree depth and so as no. of disk access First one or two levels of the tree are stored in main memory to speed up searching Most internal nodes have less than (m-1) searching keys most of the time huge space wastage for main memory, but not a big problem for disk
B+-Tree — Searching Example 1 P M = L = 4 F J U A B C D F G J K L M U V P Q Search G Found!!

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

View Full Document
B+-Tree — Searching Example 2 Search H P F J U A B C D F G J K L M U V P Q Not Found!! M = L = 4
B+-Tree — Searching Algorithm Searching KEY: Start from the root If an internal node is reached: Search KEY among the keys in that node linear search or binary search

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 / 37

T9 - B-Tree COMP171 Tutorial 9 Deficiency of AVL Tree...

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

View Full Document
Ask a homework question - tutors are online