This project contains fundamental algorithm and data structure implementations, done as part of The Odin Project curriculum.
It focuses on recursive thinking, sorting, linked lists, hash maps, and now includes a fully-featured binary search tree with balance and traversal operations.
algo-practice/
├── recursion/
│ ├── iterative.js
│ └── recursive.js
├── merge-sort/
│ └── mergeSort.js
├── linked-list/
│ ├── Node.js
│ ├── LinkedList.js
│ ├── test.js
│ └── README.md
├── hashmap/
│ ├── hashMap.js
│ ├── test.js
│ └── README.md
├── binary-search-tree/
│ ├── Node.js
│ ├── Tree.js
│ ├── driver.js
│ ├── prettyPrint.js
│ └── README.md
└── README.md
fibs(limit)
→ Iterative Fibonacci generatorfibsRec(limit)
→ Recursive Fibonacci generator
mergeSort(arr)
→ Recursive merge sort implementation- Includes a custom
merge()
function to combine sorted halves
- Node.js → Defines the Node structure
- LinkedList.js → Contains core linked list methods like:
append()
,prepend()
,size()
,at()
,pop()
,find()
,contains()
,toString()
- test.js → Sample test cases to validate the implementation
- Custom
HashMap
class with:- Chained collision handling
- Resizing logic when load factor exceeds 0.75
- Methods like
set
,get
,has
,remove
,clear
,keys
,values
,entries
- Notes + test cases included
➡️ View detailed HashMap README →
Node.js
andTree.js
→ Fully-featured Balanced BST implementationbuildTree()
builds a balanced tree from sorted unique array- Supports:
insert()
,deleteItem()
,find()
height()
,depth()
,isBalanced()
,rebalance()
- Traversals:
inOrder
,preOrder
,postOrder
,levelOrder
with callbacks
- Includes a
prettyPrint()
visualizer anddriver.js
demo ➡️ View detailed BST README →
fibs(8);
// ➜ [0, 1, 1, 2, 3, 5, 8, 13]
fibsRec(10);
// ➜ [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
mergeSort([3, 2, 1, 13, 8, 5, 0, 1]);
// ➜ [0, 1, 1, 2, 3, 5, 8, 13]
mergeSort([105, 79, 100, 110]);
// ➜ [79, 100, 105, 110]
- The difference between iterative vs recursive solutions.
- How to build data structures from scratch — LinkedList, HashMap, BST.
- Handling collisions and resizing logic in hash-based storage.
- Balancing and traversing binary search trees efficiently.
- The importance of clear, testable, modular code.
- How lower-level data structures power high-level abstractions.
This project is for educational purposes under the MIT License.