← All courses

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

Unit 1: What a Program Is and How It Runs5 topics · 25 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

Unit 2: Variables, Types, and Memory6 topics · 28 questions

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

Unit 3: Expressions and Operators5 topics · 23 questions

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

Unit 4: Control Flow5 topics · 23 questions

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

Unit 5: Loops and Loop Invariants6 topics · 27 questions

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

Unit 6: Functions, Scope, and the Call Stack7 topics · 35 questions

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

Unit 7: Recursion6 topics · 27 questions

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

Unit 8: Arrays, Lists, and Strings7 topics · 29 questions

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

Unit 9: Dictionaries, Hashing, and Sets6 topics · 25 questions

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

Unit 10: References, Aliasing, and Mutability5 topics · 21 questions

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

Unit 11: File I/O and Exceptions6 topics · 26 questions

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

Unit 12: Object-Oriented Programming8 topics · 36 questions

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

Unit 13: Algorithm Analysis and Big-O7 topics · 31 questions

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

Unit 14: Linked Lists6 topics · 28 questions

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

Unit 15: Stacks, Queues, and Deques6 topics · 27 questions

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

Unit 16: Trees, Binary Search Trees, and Balancing7 topics · 32 questions

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

Unit 17: Heaps and Priority Queues5 topics · 22 questions

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

Unit 18: Graphs7 topics · 33 questions

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

Unit 19: Sorting and Searching10 topics · 45 questions

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

Unit 20: Divide and Conquer, Greedy, and Dynamic Programming7 topics · 32 questions

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

Unit 21: Testing, Debugging, and Version Control5 topics · 21 questions

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