Collection of Data Structures and Algorithms in JavaScript, including several puzzels from HackerRank.
Greatly inspired by trekhleb's awesome repository.
Execute npm test to run tests (after npm i, to install all dependencies)
The complexity of a data structure can be seen as a way of expressing their advantages and disadvantages easily, according to a specifig problem.
- the space: space complexity represents the memory consumption of a data structure. You'll generally need to trade some time for space or the other way around.
- the time: you need to express the complexity for several operations you can do with a data structure (i.e. adding, deleting, accessing)
Complexity is usually expressed with the Big O notation. Here's a summary of the complexity of some famous data structures and sorting algorithms.