A collection of standard data structures and algorithms in lean Javascript. (Work in progress)
This is not production-grade code. The idea is to aid understanding by exposing the underlying logic in a reasonably clear way.
- add
- findMin/findMax
- find
- isPresent
- remove
- getMinHeight
- getMaxHeight
- isBalanced
- Depth-first search
- inOrderTraversal
- preOrderTraversal
- postOrderTraversal
- Breadth-first search
- levelOrderTraversal
- add
- has
- values
- remove
- clear
- size
- union
- intersection
- difference
- subset
- same as queue plus enqueue considering priority
- enqueue
- dequeue
- front
- size
- isEmpty
- push
- pop
- peek
- length
- push
- pop
- peek
- length
- v1 - imperative approach
- v2 - reduce everything
- v3 - map arrays, reduce objects