Introduction to Computer Science
The CS1/CS2 sequence made visible: the call stack, pointer surgery on a linked list, sorts racing, and a DP table filling in.
21 units · 132 topics · 596 questions
What actually happens between typing code and a computer doing something, and the three kinds of mistakes that stop it.
What a Program Actually Is · From Source Code to Machine Code · The Fetch-Decode-Execute Cycle · Syntax Errors, Runtime Errors, and Logic Errors · +1 more
Where a value actually lives when you name it, why types matter, and the two classic ways numbers misbehave.
Variables as Names for a Place in Memory · Primitive Types: Integers, Floats, Booleans, and Strings · Static Typing Versus Dynamic Typing · Type Conversion and Casting · +2 more
The rules for reading a compound expression the same way the computer does, from arithmetic to boolean logic.
Arithmetic Operators and Precedence · Comparison and Boolean Operators · Short-Circuit Evaluation · Operator Precedence in a Compound Expression · +1 more
How a program picks one path over another, and the boolean logic underneath every branch.
if / else Branching · Nested and Chained Conditionals · Boolean Logic and Truth Tables · Guard Clauses and Early Return · +1 more
Repetition that stops on its own, the property that stays true every pass, and the ways a loop runs forever by mistake.
The while Loop · The for Loop and Counted Iteration · Loop Invariants: What Stays True on Every Pass · Infinite Loops and Off-by-One Errors · +2 more
Why code gets cut into named pieces, where a variable can be seen from, and the stack of frames that makes it all work.
Why Factor Code into Functions · Parameters, Arguments, and Return Values · Local Versus Global Scope · The Call Stack · +3 more
A function that calls itself, traced frame by frame on the call stack, where it shines, where it explodes, and how memoization tames it.
Base Case and Recursive Case · Tracing Recursion on the Call Stack · Stack Overflow from Infinite Recursion · Tree Recursion: Naive Fibonacci · +2 more
Contiguous storage, zero-based indexing, and the sequence type every other data structure gets compared against.
Arrays and Zero-Based Indexing · List Operations and Their Cost · Two-Dimensional Arrays and Grids · Strings as Sequences of Characters · +3 more
Looking a value up by key instead of by position, the hash function underneath, and what happens when two keys collide.
Dictionaries and Key-Value Lookup · Hash Functions: Turning a Key into an Index · Resolving Collisions with Chaining · Resolving Collisions with Open Addressing · +2 more
What a variable is actually holding, two names pointing at one object, and why == and is don't always agree.
Variables as References to Objects · Aliasing: Two Names, One Object · Mutable Versus Immutable Types · Shallow Copy Versus Deep Copy · +1 more
Reading and writing outside the program's own memory, and catching the errors that show up when the outside world misbehaves.
Opening, Reading, and Closing a File · Writing to a File · Using a Context Manager to Handle a File · try / except and Catching an Error · +2 more
Bundling data with the behavior that acts on it, and the four ideas that make it scale: encapsulation, inheritance, polymorphism, composition.
Classes and Objects: Blueprint Versus Instance · Constructors and Instance State · Encapsulation: Hiding Data Behind Methods · Inheritance: Sharing Behavior Across a Class Hierarchy · +4 more
Measuring how an algorithm's work grows instead of timing it once, and the handful of curves everything eventually reduces to.
Measuring Growth Instead of Timing an Algorithm · Big-O as an Upper Bound · Big-Omega and Big-Theta · Best Case, Average Case, and Worst Case · +3 more
Nodes scattered anywhere in memory, connected by pointers alone, and the exact order of reassignments that keeps or loses the rest of the list.
Singly Linked List Structure: Nodes and next Pointers · Traversing a Linked List · Inserting a Node: The Exact Order of Pointer Reassignments · Deleting a Node and Losing the Rest of the List · +2 more
Two disciplines for what comes out next, last in first out and first in first out, and the double-ended structure that does both.
The Stack ADT: Last In, First Out · The Queue ADT: First In, First Out · Implementing a Stack or Queue with an Array Versus a Linked List · Deques: Double-Ended Queues · +2 more
Branching structure instead of a straight line, the three orders you can walk a tree, and why an unbalanced tree quietly turns into a list.
Tree Terminology: Root, Leaf, Height, and Depth · Binary Tree Traversals: Preorder, Inorder, and Postorder · Level-Order Traversal: Breadth-First on a Tree · Binary Search Tree Insert and Search · +3 more
A tree that only promises its smallest or largest value sits on top, and the two moves, sift up and sift down, that keep that promise.
The Heap Property and Its Array Representation · Sift-Up: Restoring the Heap After an Insert · Sift-Down: Restoring the Heap After Extract-Min · Building a Heap from an Unordered Array · +1 more
Nodes connected by edges instead of a strict hierarchy, and the handful of algorithms that spread across them, find a path, or connect them all.
Graph Terminology and Representations · Breadth-First Search: Spreading in Rings · Depth-First Search: Plunging Down One Path · BFS Versus DFS Side by Side on the Same Graph · +3 more
Every classic sort racing on the same array with comparisons ticking, plus the two ways to search once the data is or isn't sorted.
Bubble Sort · Selection Sort · Insertion Sort · Merge Sort · +6 more
Three ways to attack a hard problem: break it in half, grab the best choice available now, or remember every subproblem you've already solved.
Divide and Conquer as a General Pattern · Greedy Algorithms: The Locally Best Choice · When Greedy Fails · Dynamic Programming: Overlapping Subproblems and Optimal Substructure · +3 more
The habits that catch a bug before a user does, and the safety net that lets you undo a change or work alongside someone else.
Writing a Unit Test · Edge Cases: Empty Input, One Element, and Boundary Values · Debugging by Stepping Through a Program · Git Commits and a Repository's History · +1 more