InterviewPrepKit

Home / Cheat Sheet / Algorithms & Data Structures with Python

Algorithms & Data Structures with Python — cheat sheet

A from-zero crash course: Python itself, every core data structure, and the classic algorithms — enough to start solving problems. Each card is the short version of its full lesson.

How Python Runs Your Code

Numbers, Strings, and Booleans

Lists, Tuples, and Slicing

Dictionaries and Sets

Control Flow: if, for, while

Functions, Arguments, and Scope

Comprehensions and Iterators

Generators and yield

Classes and Objects

Recursion

Big-O and Complexity Analysis

Dynamic Arrays (How Python Lists Work)

Linked Lists

Stacks, Queues, and Deques

Hash Maps (How dict Works)

Trees and Binary Search Trees

Heaps and Priority Queues

Graphs and How to Represent Them

Tries (Prefix Trees)

Union-Find (Disjoint Sets)

Searching: Linear and Binary Search

Sorting I: Bubble, Insertion, Selection

Sorting II: Merge Sort

Sorting III: Quicksort

Sorting IV: Heap Sort and Counting Sort

Graph Traversal: BFS and DFS

Shortest Paths: Dijkstra

Shortest Paths: Bellman-Ford

Topological Sort

Dynamic Programming Basics

Greedy Algorithms

Backtracking

String Matching: Rabin–Karp and KMP

Two Pointers

Sliding Window

Prefix Sums and Difference Arrays

Fast and Slow Pointers (Cycle Detection)

Monotonic Stack and Deque

Bit Manipulation

Number Theory: GCD, Primes, and Modular Arithmetic

Report a bug