B-Tree

Features:
  1. Its a self balancing tree
  2. All its nodes live in the main memory. 
  3. If the height of the tree is long then nodes are accessed from the disk in the form of blocks. Hence the height is kept low and it reduces the disk access. Disk access time is low compared to AVL trees, Red-Black trees, etc.
  4. All leaves are at same level. 
  5. A factor x is defined that determines number of keys. 
  6. Node may contain 1 key. 
  7. All nodes must contain atleast t-1 keys and atmost 2t-1 keys.
  8. Keys are stored in ascending order.
  9. It grows and shrinks in size unlike BST. 
  10. O(Logn) is for search, insert, and delete.

Search operation:
  1. If key to be searched is x, we start by looking at the root node. 
  2. If x > root then we search RHS of the tree. 
  3. In the node we look for all the values sequentially. If the intended node doesn't has the key then we go back to root, look for next key sequentially present in the root and repeat step 2. 
  4. If x<root then we search for LHS of the tree.
  5. Repeat step similar to 3.
  6. If we don't find the keys in any of the nodes then we return Null.

Traverse operation:

No comments:

Post a Comment

NoSQL

This one is reviewed but I need to delete its copy from hubpages or somewhere NoSQL Data models: key-value  Aggregate model.  key or i...