Hash Table vs Self-Balancing BT
| Hash table | BST(Binary Search Tree) | |
|---|---|---|
| Complexity(Insert/Delete/Search) | O(1)[Average Time], O(n) during table resize | O(log n)[guaranteed all times]. |
| Collision | Yes | Never |
| Implementation | Tough, We depend on libraries | Easy, we can implement our own customized BST |
| Advantages of Tree over HT |
1. Data can be retrieved in sorted order. inorder-traversal: O(n) 2. lowest, biggest element finding: easy 3. No need to guess size of input data |