Set up your courses
Pick the courses you're taking and this page shows only those. About 30 seconds.
Code, one block at a time.
Short lessons: predict first, try it in a model, then see why it works.
Start the first lessonNo sign-up. Your progress saves on this device, and you can keep it later with an email.
Know some data structures already?
Answer about 10 questions and skip the units you know. New to it? Start with the first lesson below.
Classes and objects
Define classes with attributes and methods, give them __str__ and __eq__, predict what aliasing and function calls do to objects, build objects out of other objects, use a class through its interface, and extend one with inheritance.
Formulas: Classes and objectsHow fast is it?
Count the steps a loop takes, simplify the count to big-O, rank the common growth classes, tell best from worst case, know what Python's list, dictionary and set operations cost, and choose the algorithm that scales.
Stacks
Predict what a stack holds after pushes and pops, build a Stack class on a list with its top at the end, guard the empty stack, and use stacks to check brackets, reverse things, convert to binary and evaluate and produce postfix.
Queues and deques
Predict what a queue holds, build queues on a list and on two stacks and judge their costs, simulate a circle with a queue, check palindromes with a deque, and choose a stack, queue or deque for a task.
Linked lists
Build chains of nodes, walk them, add and remove nodes at the front, the end and the middle, reverse them, and say when a linked list beats a Python list.
Recursion
Write functions that call themselves, trace their calls on the call stack, count the calls of a branching recursion, speed it up with a memo, and solve making change and the Tower of Hanoi.
Searching and hashing
Search a sorted list by halving and write binary search with correct bounds, store keys in hash tables with linear probing or chaining, and judge what a lookup costs as the table fills.
Sorting
Run bubble, selection and insertion sort pass by pass and count their work, say which sorts are stable, merge sorted lists, sort by merge sort and quicksort, and choose a sort for the data.
Trees and traversals
Name the parts of a tree, build binary trees from nodes, write recursive functions on them with the empty tree as the base case, and visit their nodes in preorder, inorder, postorder and level order.
Binary search trees
Check the search-tree rule, search and insert into a binary search tree, see how insertion order sets its shape and cost, find the smallest and largest values, sort with it and delete from it.
Heaps and priority queues
Use a priority queue, check and store a min-heap in a list, push by sifting up and pop the smallest by sifting down in O(log n), and use Python's heapq to serve tasks and keep the k largest items.
Graphs
Store graphs as adjacency lists and matrices, search them breadth first and depth first, find fewest-edge and least-weight paths, order tasks topologically, and choose the right algorithm for a problem.