Preface
Two Jobs
The idea behind the title
What the sessions cover
How to read Easy
Running the Easy programs
Other books to read alongside
Structure first, then steps
Session 1. Basic Concepts
What you’ll learn
1.1 How a computer helps us solve a problem
1.2 Data types, abstract data types, and data structures
1.3 What we mean by an algorithm
1.4 Two ways to store an abstract data type
1.4.1 Side by side in an array
1.4.2 Linked through addresses
1.5 Building an exam schedule
Summary and key ideas
Exercises
Bibliographic notes
Session 1 Quiz
3 attempts allowed
Session 2. Mathematical Preliminaries
What you’ll learn
2.1 The notation and the small functions we will need
2.1.1 Rounding down, rounding up, and remainder
2.1.2 Evaluating a polynomial
2.1.3 Powers of a number
2.1.4 How logarithms grow
2.1.5 Factorials, or n!
2.1.6 The Fibonacci numbers
2.2 Sets of elements
2.3 Relations between elements
2.4 Counting arrangements and selections
2.4.1 Adding counts and multiplying counts
2.4.2 Arrangements in order
2.4.3 Selections without regard to order
2.5 Adding a sequence of terms
2.5.1 Arithmetic series, where the step is constant
2.5.2 Geometric series, where each term is a multiple of the last
2.5.3 The harmonic series
2.5.4 A few other useful sums
2.6 Recurrences, or when a formula refers to earlier values
2.7 Ways of proving a claim
2.7.1 Proof by induction
2.7.2 Proof by contradiction
2.7.3 Disproving a claim with a counterexample
Summary and key ideas
Exercises
Bibliographic notes
Session 2 Quiz
3 attempts allowed
Session 3. Algorithms
What you’ll learn
3.1 Writing an algorithm so someone else can run it
3.1.1 Storing a value: the assignment
3.1.2 Jumping to another step
3.1.3 Choosing a step with a test
3.1.4 Repeating a step
3.1.5 Reading input and writing output
3.1.6 Naming the data a program will use
3.1.7 Starting, stopping, and calling a procedure
3.1.8 How an Easy program is put together
3.1.9 Three short programs in Easy
Insertion sort
Binary search
The Towers of Hanoi
3.2 Counting how much work an algorithm does
3.2.1 Counting the steps in insertion sort
3.2.2 The notation we use for growth
3.2.3 Big-O, an upper bound
3.2.4 Omega, a lower bound
3.2.5 Theta, when the bounds meet
3.2.6 Why people usually write O
3.2.7 Which functions grow faster
3.2.8 Grouping problems by how hard they are
Summary and key ideas
Exercises
Bibliographic notes
Session 3 Quiz
3 attempts allowed
Session 4. Stacks
What you’ll learn
4.1 A stack in an array
4.1.1 Empty, full, and the other small checks
4.1.2 Pushing a value onto the stack
4.1.3 Popping a value off the stack
4.1.4 The array stack, written in Pascal
4.1.5 The array stack, written in C
4.2 A stack as a linked chain
4.2.1 The small checks on a linked stack
4.2.2 Pushing onto a linked stack
4.2.3 Popping from a linked stack
4.2.4 The linked stack, written in Pascal
4.2.5 The linked stack, written in C
4.3 What a stack is good for
4.3.1 Matching brackets
4.3.2 From infix to postfix
4.4 Several stacks in one array
4.4.1 Two stacks that grow toward each other
4.4.2 Three or more stacks sharing an array
4.4.3 Making room when a stack overflows
Summary and key ideas
Exercises
Bibliographic notes
Session 4 Quiz
3 attempts allowed
Session 5. Queues and Deques
What you’ll learn
5.1 A queue in a straight array
5.1.1 Adding a value at the back
5.1.2 Taking a value from the front
5.2 A queue that wraps around
5.2.1 Enqueue and dequeue in a circular array
5.2.2 The circular array queue, written in C
5.3 A queue as a linked chain
5.3.1 Adding a node at the back
5.3.2 Removing a node from the front
5.3.3 The linked queue, written in C
5.4 A queue for a topological sort
5.5 The deque, which works at both ends
5.6 A deque in a straight array
5.6.1 Adding a value at either end
5.6.2 Removing a value from either end
5.7 A deque that wraps around
5.7.1 The four operations in a circular array
5.8 A deque as a linked chain
5.8.1 The four operations on a linked deque
Summary and key ideas
Exercises
Bibliographic notes
Session 5 Quiz
3 attempts allowed
Session 6. Binary Trees
What you’ll learn
6.1 What a binary tree is
6.2 Four ways to walk a binary tree
6.3 How a binary tree sits in memory
6.4 Writing the walks
6.4.1 Preorder and postorder with recursion
6.4.2 Preorder and postorder with a stack
6.4.3 Using a walk to copy a tree or count its height
6.5 Threaded trees, which remember the next node
6.5.1 The next node and the previous node
6.5.2 An inorder walk that uses the threads
6.5.3 Inserting a node into a threaded tree
6.5.4 When two trees have the same shape, or the same shape and the same values
6.6 Walking a tree by turning links around
6.7 Walking a tree with exclusive-or links
Summary and key ideas
Exercises
Bibliographic notes
Session 6 Quiz
3 attempts allowed
Session 7. Applications of Binary Trees
What you’ll learn
7.1 Water loss in a canal network
7.2 Heaps and heapsort
7.2.1 Sifting down: turning a complete tree into a heap
7.2.2 Heapsort
7.3 Priority queues
7.3.1 A priority queue in an unsorted array
7.3.2 A priority queue in a sorted array
7.3.3 A priority queue as a heap
Summary and key ideas
Exercises
Bibliographic notes
Session 7 Quiz
3 attempts allowed
Session 8. Trees and Forests
What you’ll learn
8.1 What trees and forests are
8.2 The natural correspondence between a forest and a binary tree
8.3 Walking a forest
8.4 How a forest sits in memory as a linked structure
8.5 How a forest sits in a compact array
8.5.1 Links and tags in an array
8.5.2 An arithmetic expression as a tree
8.6 Trees for equivalence classes
8.6.1 The equivalence problem
8.6.2 Keeping the trees bushy when we unite
8.6.3 Shortening the path when we find a root
8.6.4 What union and find cost
8.6.5 Putting union and find together
Summary and key ideas
Exercises
Bibliographic notes
Session 8 Quiz
3 attempts allowed
Session 9. Graphs
What you’ll learn
9.1 What a graph is
9.2 How a graph sits in memory
9.2.1 The adjacency matrix
9.2.2 The adjacency lists
9.3 Walking a graph
9.3.1 Depth-first search
9.3.2 Breadth-first search
9.4 What the two walks are good for
9.4.1 Spotting a directed graph with no cycles
9.4.2 A topological sort from a depth-first walk
9.4.3 Strongly connected components
9.4.4 Articulation points and biconnected pieces
9.4.5 Whether an undirected graph has a cycle
Summary and key ideas
Exercises
Bibliographic notes
Session 9 Quiz
3 attempts allowed
Session 10. Applications of Graphs
What you’ll learn
10.1 A cheapest spanning tree
10.1.1 Prim’s algorithm
10.1.2 Kruskal’s algorithm
10.2 Shortest paths
10.2.1 Dijkstra’s algorithm, from one start to every other node
10.2.2 Floyd’s algorithm, between every pair of nodes
10.2.3 Warshall’s algorithm and whether a path exists
Summary and key ideas
Exercises
Bibliographic notes
Session 10 Quiz
3 attempts allowed
Session 11. Linear Lists
What you’ll learn
11.1 What a linear list is
11.2 A list in an array
11.3 A list as a chain of nodes
11.3.1 A straight chain with one link per node
11.3.2 The same chain, with a header node
11.3.3 A circular chain
11.3.4 A circular chain with a header node
11.3.5 A chain that links both ways
11.4 Adding and multiplying polynomials
11.5 Long integers, digit by digit
11.5.1 Adding and subtracting long integers
11.5.2 Multiplying long integers
11.5.3 How a long integer sits in memory
11.5.4 The Easy procedures for long integers
11.6 A pool of memory you can request and return
11.6.1 The memory pool
11.6.2 Finding a free block that fits
11.6.3 Returning a block and merging neighbors
11.6.4 The buddy system
11.7 A qualifying list
11.7.1 Who qualifies
11.7.2 How the lists are arranged
11.7.3 A short qualifying procedure
Summary and key ideas
Exercises
Bibliographic notes
Session 11 Quiz
3 attempts allowed
Session 12. Generalized Lists
What you’ll learn
12.1 What a generalized list is
12.2 How a nested list sits in memory
12.3 The small operations: atom, cons, head, and tail
12.4 Walking a nested list
12.5 Reclaiming nodes that are no longer used
12.5.1 Mark and gather
Summary and key ideas
Exercises
Bibliographic notes
Session 12 Quiz
3 attempts allowed
Session 13. Sequential Tables
What you’ll learn
13.1 What a table is
13.2 A table indexed directly by the key
13.3 A table that does not grow
13.3.1 Looking through the table from one end
13.3.2 Binary search in a sorted table
13.3.3 Binary search with a multiplicative step
13.3.4 Fibonacci search in a sorted table
Summary and key ideas
Exercises
Bibliographic notes
Session 13 Quiz
3 attempts allowed
Session 14. Binary Search Trees
What you’ll learn
14.1 What a binary search tree is
14.1.1 Search, insert, and the other basic steps
14.1.2 How long a search takes
14.2 Height-balanced trees, or AVL trees
14.3 Rotations that restore the balance
14.4 A binary search tree that is as cheap as it can be
Summary and key ideas
Exercises
Bibliographic notes
Session 14 Quiz
3 attempts allowed
Session 15. Hash Tables
What you’ll learn
15.1 Turning a key into a number
15.2 Choosing a hash function
15.2.1 Division, or taking the remainder
15.2.2 Multiplication, then taking a slice of the bits
15.3 Collisions, handled with a chain
15.3.1 The Easy procedures for a chained table
15.3.2 How long a chained lookup takes
15.4 Collisions, handled by looking in another slot
15.4.1 Linear probing
15.4.2 Quadratic probing
15.4.3 Double hashing
15.4.4 The Easy procedures for an open-address table
15.4.5 Keeping the open-address table in order
15.4.6 How long an open-address lookup takes
Summary and key ideas
Exercises
The two jobs
Bibliographic notes
Session 15 Quiz
3 attempts allowed
Final Exam
Final Exam
2 attempts allowed
Public Examples
Open books
Session 1
Session 2
Session 3
Session 4
Session 5
Session 6
Session 7
Session 8
Session 9
Session 10
Session 11
Session 12
Session 13
Session 14
Session 15
Sources and Further Reading
The Data Structures & Algorithms Explainer: The Course
A friendly path from the first ideas to the algorithms that take practice, in pseudocode notation and Python.
A friendly path through data structures and algorithms, in pseudocode notation and Python. Each session ends with a quiz, and a final exam earns you a certificate.
Minimum price
$149
$149
You pay
Author earns
About
About the Course
The Data Structures & Algorithms Explainer
A friendly path from the first ideas to the algorithms that take practice, in pseudocode notation and Python.
What You'll Learn
- Tell a data type, an abstract data type, and a data structure apart
- Read and write the same step in pseudocode notation and in Python
- Count a procedure with the bounds that matter, and read big-O without mixing it up
- Build a stack, a queue, and a deque, and use them for brackets, postfix, and a topological sort
- Walk trees and heaps, and say what each operation costs
- Walk a graph, find a cheapest spanning tree and a shortest path, and know when each algorithm applies
- Search a static table, a binary search tree, and a hash table, and say what each collision policy costs
Who Is This Course For?
Beginners meeting data structures and algorithms for the first time, students in a first course, working developers preparing for interviews, and anyone who learned this once and wants it back, now with enough depth to go further.
Prerequisites
You need to read simple Python and remember some high-school math. Every term is explained the first time it appears, and the opening sessions teach the pseudocode notation from scratch. No prior course in data structures is required.
Why This Course?
Each session starts from a drawing, walks it with real numbers, and ends with a check you can do on paper. Every step is written first in pseudocode notation and then in Python, so you can see the same idea two ways. Quizzes after every session, and a final exam, help the ideas stick.
How It Works
- 15 sessions, each ending with a 5-question multiple-choice quiz (3 attempts, best score counts)
- A 20-question final exam covering the whole course
- 95 quiz questions in total
- Score 70% to pass; 85% or more earns honors
- Pass to receive a certificate of completion
Written by Joel Bryan Juliano.
Instructor
About the Instructor
Hi, I'm Joel.
I am Dutch-Filipino Software Engineer with 20+ years of experience.
And with over 20 years in the game, I’ve seen it all and loved every minute of it.
My journey has taken me through a variety of industries, from sports streaming to cybersecurity, both in the private sector and for the Dutch government, and everything in between.
Along the way, I’ve picked up a diverse set of skills and experiences, in which I document into books.
Material
Course Material
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Write and Publish on Leanpub
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.