Arrays: Static and Dynamic, and the Cost Model You Already Know
You've been using arrays since your first program. [1, 2, 3] in Ruby. int arr[10] in C. They feel obvious — a row of values you can index into. But there are two distinct things h…
Linear Data Structures covers: Arrays, Linked Lists, Abstract Data Types, Stacks, Queues, Deques, and the Ruby Shift/Unshift Lens. Year 1, Quarter 2. Includes 15 exercises and 3 projects.
This course unlocks once you've finished its prerequisite. Open prerequisite →
You've been using arrays since your first program. [1, 2, 3] in Ruby. int arr[10] in C. They feel obvious — a row of values you can index into. But there are two distinct things h…
In the last lesson you saw a sequence built out of contiguous memory — one big slab, indexed by offset. Linked lists are the opposite: a sequence made of scattered nodes, each one…
You just learned two ways to build a sequence — arrays and linked lists — with opposite performance profiles. Now suppose you're writing code that needs a sequence. You add items …
You've already used a stack thousands of times — every function you've called has pushed a frame onto one, and every time the function returned, a frame popped off. The pattern is…
A stack is what you reach for when the most recent thing matters most. A queue is what you reach for when the oldest thing matters most — the line at the coffee shop, the print jo…
- [ ] Contains Duplicate (#217) — NC/LC — Use a Set to detect duplicates in O(n) - [ ] Valid Parentheses (#20) — NC/LC — Stack-based matching of brackets - [ ] Implement Queue usi…
- [ ] Min Stack (#155) — NC/LC — Stack that supports O(1) getMin - [ ] Evaluate Reverse Polish Notation (#150) — NC/LC — Stack-based expression evaluation - [ ] Daily Temperatures…
- [ ] Largest Rectangle in Histogram (#84) — NC/LC — Monotonic stack, O(n) solution - [ ] Sliding Window Maximum (#239) — NC/LC — Monotonic deque for O(n) sliding max - [ ] Car Fl…
- [ ] Build a calculator in Ruby — parse infix expressions, convert to postfix (Shunting-yard algorithm), evaluate with a stack; support +, -, , /, (, ), and operator precedence
Build MyArray in Ruby that behaves like Ruby's Array but you implement the dynamic resizing yourself (backed by a fixed-size C-style array conceptually). Implement push, pop, shif…
Implement a text buffer with undo/redo using two stacks. Support operations: insert(pos, text), delete(pos, length), undo, redo. Each operation pushes its inverse onto the undo st…
- [ ] Milestone 1: Implement MyDynamicArray with amortized O(1) append - [ ] Milestone 2: Implement MyHash with chaining, rehashing at load factor 0.75 - [ ] Milestone 3: Implemen…
- [ ] What is the difference between an array and a linked list? What are the time complexities for insertion, deletion, and access in each? - [ ] What is amortized O(1) for dynam…
13 lessons. Read in order; spiral back when you need to. By the end you'll have used the core ideas twice — once on the abstract, once on something you'll meet at work next week.