Computer Science Deep Dive

Welcome

You write code for a living, and nobody ever explained why a dictionary lookup is instant and a list search is not, why the second read of a file is faster than the first, why two threads can lose an update that both of them made, or why some programs can never be written at all. This is the core of a computer science degree, taught to working engineers: every idea explained in plain words, drawn as a figure, illustrated with short Python, and ended on what it costs in the systems you already run.

14 chapters 80 topics covered Knowledge check on every topic ≈18 hours to complete

About This Course

Every choice a computer makes has a price, and the price comes from the layer underneath. A dictionary lookup is fast because of a hash table, which is fast because reading one slot of an array is one address calculation and one memory read, which is fast only if that memory is already in the processor's cache. The second read of a file is fast because the operating system kept its pages in memory. Two threads lose an update because adding one to a counter is three separate steps. This book teaches one question, what does it cost and why, and then answers it for one layer per chapter.

It moves in five parts. Cost comes first: how to reason about what an operation costs and how that cost grows, which is the free first chapter. Then the machine: how information is represented, how the processor runs it, and how memory really behaves. Then structures and algorithms: the containers, trees, sorts, graphs and design techniques that real systems are built from. Then systems: the operating system, concurrency and reliable delivery over a channel that loses messages. Last come languages and limits: how a language turns text into running code, and what no computer can ever do.

Where one real system makes an idea clearer, the book uses Lantern, the search service of a public library with 2 million catalogue records and one engineer, Noor. Its index is a hash table, its autocomplete is a trie, its typo tolerance is dynamic programming, and its query language is the example the compiler chapter takes apart. Lantern appears only where it is the clearest example. There is no plot to follow.

Who This Is For

Engineers without a computer science degree: developers, DevOps and QA engineers who write code, run services and read stack traces, but never took the courses. The bar is concrete. You can read a short Python function with a loop, a list and a dictionary in it, and you have seen a program be slow without knowing why. No mathematics beyond arithmetic is assumed, and no proof appears anywhere in the book.

It is not a first course on computers. If a byte, a process or a packet is a term you would have to look up, read Computing Foundations from Zero in this catalogue first; this book starts where that one stops. It is also not a book of tools or of interview drills. It never teaches a command, and where a tool is the natural way to watch an idea at work, it names the course that teaches that tool.

What You Should Already Know

  • What a computer's parts are: processor, memory, storage and the operating system that runs programs
  • Reading a short Python function: variables, loops, lists, dictionaries and a function call
  • Having run a program that was slower than you expected, on data larger than you tested with
  • Nothing about computer science itself: complexity, structures, algorithms, the machine and the theory are all built from zero

New to this? Start with Computing Foundations from Zero - the first chapter of every course is free, and the rest is one membership.

How the Course Is Built

Every topic has the same shape: an opening that says what the idea is and why it exists, the mechanism explained in plain words and drawn as a figure, the misconceptions working engineers actually hold about it, what the idea means for the systems you run, and a short knowledge check. Short Python examples illustrate; they are never the lesson, and the prose around every example says in words what the code shows.

Every cost gets a number. About 21 looks to find one name among 2 million sorted entries. About a hundred nanoseconds for a trip to main memory. About 40 megabytes for a million integers in a Python list. Specific figures are what let you predict behaviour you have not measured, and predicting behaviour is the point of the whole book.

Every choice has a price
Every page ends on what its idea costs in a system you already run: a web service, a database, a build pipeline, a Python script. A structure without its price is a glossary entry.
The price comes from underneath
Every "it is fast" has a reason one layer down, and every reason has a limit. The book walks down from the dictionary to the cache line, and from the program to the ceiling of what can be computed.
Mechanism, not tools
The ideas every implementation shares, with no commands and no configuration. Where a tool shows an idea at work, the course that teaches the tool is named.
Intuition, not proof
Growth curves and counted steps instead of formulas. Where a famous result has a proof, the argument is told in plain words, short enough to retell at lunch.

Chapter Map

Chapter 1
Thinking in Cost
What the field studies, counting steps instead of timing runs, Big-O by intuition, seven growth classes with numbers at a million items, averages against guarantees, and memory as the second price.
Chapter 2
Representing Information
The same bytes read four ways, fixed-width integers and overflow, why 0.1 + 0.2 is not 0.3, Unicode and UTF-8, byte order and serialization, and why random data does not compress.
Chapter 3
The Machine
The tower of abstraction, gates that add, the fetch-decode-execute loop, the call stack, pipelines and branch prediction, and the end of free clock speed.
Chapter 4
Memory and Its Hierarchy
The latency ladder from a register to another continent, cache lines and locality, the heap and its allocator, garbage collection, memory safety, and the day Big-O lies.
Chapter 5
Arrays, Lists and Hash Tables
Arrays and dynamic arrays, linked lists and why they lose, stacks, queues and ring buffers, hash tables in depth, hash flooding, and choosing a container by the operation.
Chapter 6
Trees
Traversal, binary search trees and how sorted input ruins them, balanced trees, heaps for the top ten, tries for autocomplete, and the B-tree shaped for disks.
Chapter 7
Searching and Sorting
Binary search and its off-by-one traps, the simple sorts and when they win, merge sort and quicksort, the n log n speed limit, and the hybrid sorts libraries actually ship.
Chapter 8
Graphs
Graphs as a model, breadth-first and depth-first search, dependency graphs and topological order, shortest paths, and connectivity with union-find.
Chapter 9
Designing Algorithms
Divide and conquer, greedy choices and where they fail, dynamic programming and edit distance, backtracking, and small, fast, almost-right probabilistic structures.
Chapter 10
The Operating System, Underneath
Privilege and the system call, the process as a private machine, scheduling policies, virtual memory and the TLB, the page cache, and what fsync really promises.
Chapter 11
Concurrency
Concurrency against parallelism and Amdahl's law, the lost update, locks and their price, deadlock, atomics and memory models, and event loops with the GIL.
Chapter 12
Reliable Communication
Loss, duplication, reordering and corruption; checksums and CRCs; acknowledgements and the sliding window; congestion; and why exactly-once delivery cannot exist.
Chapter 13
How Languages Run
A query language lexed, parsed, type-checked and evaluated; bytecode virtual machines; compilers and optimization passes; and why the same language runs at different speeds.
Chapter 14
The Limits of Computation
Regular expressions as machines and the outage they cause, what they cannot parse, Turing machines, the halting problem, P against NP, and life below the ceiling.

Disclaimer

This course is an independent educational project created and maintained by Sergey Okinchuk. It is provided for learning and reference purposes only.

No affiliation. This course is not affiliated with, sponsored by, endorsed by, or officially connected to any company, product, or project mentioned, including the Python Software Foundation, Intel, AMD, Arm, Apple, NVIDIA, Microsoft, Google, the Linux Foundation, or the PostgreSQL Global Development Group. All opinions, interpretations, and recommendations expressed are the author's own.

Trademarks. Product and project names referenced, including "Python", "CPython", "Linux", "x86", "Arm", "PostgreSQL", and "SQLite", are the property of their respective owners. Use of these names is for identification and educational purposes only and does not imply any endorsement. Lantern and the Millbrook Public Library are fictional; any resemblance to a real service or library is coincidental.

Not operational advice. This material teaches how computing systems work and what their design choices cost, not turnkey instructions for any specific environment. Code snippets and figures are simplified for learning, and performance numbers are orders of magnitude, not measurements of your hardware. Always measure on the system you actually run before acting on a number.

Accuracy and currency. The ideas in this course change slowly, but implementations do not. Facts about specific software reflect the author's understanding at the time of writing against Python 3.15; hardware figures are typical of current machines and vary between them. Always verify version-specific behaviour against the official documentation for the versions you run.

No warranty. This material is provided "as is" without warranty of any kind. The author accepts no liability for any loss or damage arising from reliance on the content.