javascript-datastructures-algorithms
javascript-datastructures-algorithms copied to clipboard
:books: collection of JavaScript and TypeScript data structures and algorithms for education purposes. Source code bundle of JavaScript algorithms and data structures book
Learning JavaScript Data Structures and Algorithms
Source code of Learning JavaScript Data Structures and Algorithms book, third edition.
List of available chapters:
- 01: JavaScript: a quick overview
- 02: ECMAScript and TypeScript Introduction
- 03: Arrays
- 04: Stacks
- 05: Queues and Deques
- 06: LinkedLists
- 07: Sets
- 08: Dictionaries and Hashes
- 09: Recursion
- 10: Trees
- 11: Heap
- 12: Graphs
- 13: Sorting and Searching Algorithms
- 14: Algorithm Design and Techniques
- 15: Algorithm Complexity
Third Edition Updates
- Algorithms using ES2015+ (ES6+)
- New data structures and algorithms
- All chapters rewritten and reviewed
- Three (3) new chapters
- Creation of a Data Structures and Algorithms library that can be used in the browser or with Node.js
- Algorithms tested with Mocha + Chai (test code available in
testdirectory) - TypeScript version of the source code included (library and tests)
Project Structure
src/js/index.js file contains all the data structures and algorithms listed by chapter.
|_examples (how to use each data structure and algorithm, organized by chapter)
|_src
|___js (source code: JavaScript version)
|_____data-structures
|_______models (classes used by DS: Node, ValuePair, ...)
|_____others (other algorithms such as palindome checker, hanoi tower)
|___ts (source code: TypeScript version)
|_____data-structures
|_______models
|_____others
|_test (unit tests with Mocha and Chai for src)
|___js (tests for JavaScript code)
|___ts (tests for TypeScript code)
Installing and running the book examples With Node
- Install Node
- Open terminal/cmd and change directory to this project folder:
cd /Users/.../javascript-datastructures-algorithms(Linux/Max) orcd C:/.../javascript-datastructures-algorithms - run
npm installto install all dependencies - To see the examples, run
http-server htmlornpm run serve. Open your browserhttp:\\localhost:8080to see the book examples - Or
cd html/chapter01and run each javascript file with node:node 02-Variables
Running the examples in the browser
-
Right click on the html file you would like to see the examples, right click and 'Open with Chrome (or any other browser)'
-
Or open the
examples/index.htmlfile to easily navigate through all examples:
Happy Coding!
Other editions
| 1st edition | 2nd edition | 3rd edition |
|---|---|---|
![]() |
![]() |
![]() |
| Book link | Book link | Book link |
Book link - first edition:
Book link - second edition:
Book link - third edition:
Found an issue or have a question?
Please create an Issue or Pull Request


