Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Coursera

Big O notation: Python to Rust

Pragmatic AI Labs via Coursera

Overview

AI, Data Science & Cloud Certificates from Google, IBM & Meta — 50% Off
One plan covers every Professional Certificate on Coursera. 50% off Coursera Plus Annual for 10 days only — price increases June 17.
Unlock All Certificates
Big O notation: Python to Rust is a hands-on algorithmic complexity course for engineers transitioning from Python to Rust who want to reason rigorously about how their code scales. You will learn Big O, Big Theta, and Big Omega notation; analyze the time and space complexity of common operations on Python and Rust data structures (list/Vec, dict/HashMap, set/HashSet, tuple, slice, BTreeMap); and compare measured performance in both languages on identical workloads. The course covers amortized analysis, recursion and master theorem, worst case versus expected case, the cost of allocation and borrowing, and how Rust's ownership model affects real-world constants even when asymptotic complexity is identical. You will profile Python code with cProfile and timeit, profile Rust code with criterion and perf, and translate Python algorithms (search, sort, hashing, graph traversal, dynamic programming) into idiomatic Rust while keeping or improving complexity guarantees. By the end of the course, you will be able to predict performance, choose appropriate data structures, justify rewrites from Python to Rust on quantitative grounds, and communicate trade-offs to a team. Part of the Rust for Data Engineering specialization.

Syllabus

  • Three Modes of Proof for Complexity Claims
    • Set the foundation: define what "complexity" actually means as a claim, and meet the three modes of proof — analytical, empirical, and structural — you'll use to defend complexity claims throughout the course. Learn to recognize falsifiable vs. unfalsifiable performance claims and build the worked-example habit you'll need in later modules.
  • Empirical Wins — Speed You Can Measure
    • Empirical proof in practice: measure runtime with reproducible benchmarks. Three head-to-head Python→Rust translations — list comprehension to iterator, dict lookup to HashMap, and sorted() to sort_unstable — let you read benchmark output, control for noise, and decide when measured speedups are real and when they're artifacts.
  • Structural Wins — Correctness via Types
    • Structural proof in practice: use the type system to make incorrect programs impossible to compile. Translating Optional[T] to Option, try/except to Result, and ad-hoc state machines to Rust enums turns runtime errors into compile-time errors — a structural guarantee no benchmark can refute.
  • Translation with Runtime Consequences
    • Translation with runtime consequences: each translation in this module replaces a Python construct (generators, subprocess calls, parallel loops) with a Rust equivalent that carries different runtime guarantees — memory profile, error surface, parallelism model — not just "the same thing, but faster."
  • Capstone — The Three-Mode Playbook End to End
    • Capstone: bring all three modes of proof together on a real translation. Two case studies — a three-mode playbook end to end, and a deliberate "when NOT to translate" example — train your judgment about when a Python→Rust port pays off and when it would just add cost without measurable benefit.

Taught by

Noah Gift

Reviews

Start your review of Big O notation: Python to Rust

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.