Binary Search Trees
- Binary Tree in Symmetric order (Nodes - Contain info, two links)
- Each node has left and right tree, both can be null
- Every Node Key Larger than keys in left sub tree
- Every Node key smaller than keys in right sub tree
- Inserts - Find a null link by search eligible position and insert it there
- General Model for external storage
- Internal node key guide search
- External node has client key
- Insert at Bottom null node
- If Nodes are full it will split to allow insert
- Variants of BTree is used in DBs (B+ Tree, B* Tree)
Red Black Trees
- Internal Left Leaning links to glue 3 nodes
- No Nodes have two red links connected
- Every path from root to null link has same number of black links
- Use a flag color to denote red or black link in implementation
- Largest of all keys is the root
Happy Learning!!!
No comments:
Post a Comment