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

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

View Full Document Right Arrow Icon
    B + -Tree COMP171 Tutorial 9
Background image of page 1

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

View Full DocumentRight Arrow Icon
    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
Background image of page 2
    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
Background image of page 3

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

View Full DocumentRight Arrow Icon
    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
Background image of page 4
    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
Background image of page 5

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

View Full DocumentRight Arrow Icon
    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
Background image of page 6
    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!!
Background image of page 7

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

View Full DocumentRight Arrow Icon
    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
Background image of page 8
    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
Background image of page 9

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

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

This note was uploaded on 10/22/2008 for the course CS 105 taught by Professor Woo during the Spring '08 term at HKUST.

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 Right Arrow Icon
Ask a homework question - tutors are online