Data Structures Tutorial
Data structures are the different ways to organise data so your code stays fast and clear. These concise lessons implement each one in JavaScript, and every page has a live editor with a console so you build and run the real thing. Do the JavaScript track first if those basics are new.
1Data Structures IntroductionWhat data structures are and why they matter, with a live JavaScript editor and console.
2ArraysThe ordered list: fast access by index, push and pop.
3Stacks (LIFO)Last in, first out.
4Queues (FIFO)First in, first out.
5Linked ListsNodes chained by references.
6Hash MapsKey to value with near-instant lookup, using objects and Map.
7SetsA collection of unique values with instant membership tests.
8TreesBinary search trees: insert values and read them back in order.
9Big-O and Choosing a StructureHow running time grows with input size, and which structure to pick.