Features:
- Its a self balancing tree
- All its nodes live in the main memory.
- 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.
- All leaves are at same level.
- A factor x is defined that determines number of keys.
- Node may contain 1 key.
- All nodes must contain atleast t-1 keys and atmost 2t-1 keys.
- Keys are stored in ascending order.
- It grows and shrinks in size unlike BST.
- O(Logn) is for search, insert, and delete.
Search operation:
- If key to be searched is x, we start by looking at the root node.
- If x > root then we search RHS of the tree.
- 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.
- If x<root then we search for LHS of the tree.
- Repeat step similar to 3.
- If we don't find the keys in any of the nodes then we return Null.
Traverse operation:
- Inorder traversal of the tree.
- Start with left most child, print all the nodes.
- Visit the root node, print its nodes
- Then print all the right hand nodes.
You might also like:
Find White Spaces in Character Array
Find a character in the String
Number is prime or not
Finding Absolute Value
Notes on Sorting and Searching Algorithms
Common String Functions
Reverse a String
Product of all array location expect its own
Find a cycle in the Linked List
Find a binomial co-efficient
Remove duplicates from the array
Telephonic phone technical interview questions - Part 2
Counting sort algorithm
Find White Spaces in Character Array
Find a character in the String
Number is prime or not
Finding Absolute Value
Notes on Sorting and Searching Algorithms
Common String Functions
Reverse a String
Product of all array location expect its own
Find a cycle in the Linked List
Find a binomial co-efficient
Remove duplicates from the array
Telephonic phone technical interview questions - Part 2
Counting sort algorithm
No comments:
Post a Comment