This is my personal training project for LeetCode. As a FullStack developer, I want to practice the lastest feature of JavaScript. I also want to provide test cases for each question, which is missing in many similar projects.
This table below summarizes the common used data structures in JS and some examples using latest native APIs.
Data Structure | Java | JavaScript | Examples |
---|---|---|---|
array | T[] dirs = new T[5]; | new Array(5) | array.js |
dynamic array | ArrayList | [] | dynamic-array.js |
list | LinkedList | N/A | N/A |
OrderedSet OrderedMap |
TreeSet TreeMap<T1, T2> |
N/A | N/A |
HashSet HashMap |
HashSet HashMap<T1, T2> |
Set() Map() |
set.js map.js |
heap | PriorityQueue | N/A | N/A |
queue deque |
Queue Deque |
[] with push, pop, shift & unshift | queue-deque.js |
stack | Stack | [] with push & pop | stack.js |
pair tuple |
N/A | Destructuring from object | tuple.js |
MIT