work h log t n b b trees trees b b trees trees
play

( ( ) ) ( ) ( ) = = Work = h log t n B- B -Trees - PDF document

B- B -Trees Trees B B- -Trees Trees Search for key R ( ( ) ) ( ) ( ) = = Work = h log t n B- B -Trees Trees B B- -Trees Trees Each Disk-Read or Disk-Write = one Basic unit of work O(1) Typical Node x


  1. B- B -Trees Trees B B- -Trees Trees Search for key R ( ( ) ) ( ) ( ) Θ Θ = = Θ Work = h log t n B- B -Trees Trees B B- -Trees Trees Each Disk-Read or Disk-Write = one Basic unit of work O(1) Typical Node x Typical Node x B B- -Trees Trees See example on whiteboard − − ≤ ≤ ≤ − t 1 # Keys 2 t 1 ≤ ≤ ≤ ≤ t # Children 2 t = = − − ⇒ # Keys 2 t 1 node is full Thm: Let T be a B-tree with n>2 keys and of t ≥ minimum degree . Then the height h of the 2 t = ⇒ 2-3-4 B-Tree 2 B-tree is bounded above by +   n 1 ≤   h log Each node is approx. one page of HD memory t   2 1

  2. B- B -Trees Trees B B- -Trees Trees Search for key R ( ) ( ) ( ( ) ) ( ( ) ) Θ Θ = Θ = ( ) ( ) Θ Θ = = Θ Work = h log t n h log t n B- B -Trees Trees B B- -Tree Insertion Tree Insertion To INSERT, we will need procedures for splitting full nodes B- B -Trees Trees B- B -Trees Trees B-Tree-Split 2

  3. B- B -Trees Trees B B- -Trees Trees B-Tree-Split B- B -Trees Trees B B- -Trees Trees Splitting a root node Inserting Keys in a B Inserting Keys in a B- -Tree Tree B B- -Tree Deletion Tree Deletion We must make sure that the number of keys in a non-root node is always at least t 3

  4. Deleting Keys in a B Deleting Keys in a B- -Tree Tree Deleting Keys in a B Deleting Keys in a B- -Tree (Cont.) Tree (Cont.) 4

Recommend


More recommend