Short answer: A skip list is an ordered dictionary built from linked lists stacked in levels. Every key appears in the bottom list. A key is copied into the next level up with probability 1/2, independently, so the expected number of levels is O(log n) and the expected search…
How a segment tree answers a range query
Short answer: A segment tree partitions an array into segments of length a power of two, stored in a heap-indexed array of about 2n cells. A range query visits O(log n) disjoint nodes whose segments cover the query exactly. A point update walks one root path. A range update…
How a red-black tree fixes insert with colors
Short answer: A red-black tree is a binary search tree with red and black nodes. The root is black, every red node has two black children, and every path from a node to a leaf sentinel carries the same number of black nodes. Those rules keep the height at…
How A* orders expansion by f equals g plus h
Short answer: A* pops the frontier vertex with the smallest f = g + h, where g is the distance already walked and h estimates the distance still to go. If h never overestimates, it is admissible, and the first time the goal is dequeued under a consistent h…
How a Fibonacci heap makes decrease-key cheap
Short answer: A Fibonacci heap is a forest of heap-ordered trees with a cached minimum root. Insert, merge, and decrease-key are amortized O(1). Extract-min is amortized O(log n). Decrease-key cuts the node from its parent and marks the parent. A second cut on an already marked parent cascades. The…
How a Fenwick tree sums a prefix
Short answer: A Fenwick tree, or binary indexed tree, stores partial sums so that the prefix sum through index i, and a point update at i, both run in O(log n). The index trick is the least significant set bit: i & −i in two’s complement. That bit names…
How a count-min sketch estimates a frequency
Short answer: A count-min sketch estimates the frequency of items in a stream with a table of d rows and w counters. Each row has its own hash into the w columns. An update of item x by c adds c to one counter in every row. The estimate…
How a Bloom filter records membership in bits
Short answer: A Bloom filter stores a set in a bit array of m bits using k independent hash functions. Insert sets the k bits of an item to 1. A query returns present only if all k bits are 1. A present item is always reported present. An…
How a binomial heap merges in logarithmic time
Short answer: A binomial heap is a forest of binomial trees, at most one tree of each order, like the binary representation of the heap’s size. Two trees of equal order link in constant time by hanging the root with the larger key under the other. Merging two heaps…
How a binary heap sifts in an array
Short answer: A binary heap stores a complete binary tree in an array. The parent of index i is floor((i−1)/2), and the children are 2i+1 and 2i+2, for zero-based indexes. The heap property says every parent is ordered before its children. Sift up repairs an insertion at the end.…
How a B+ tree stores keys in a linked leaf level
Short answer: A B+ tree keeps every record in the leaves and copies separator keys into internal nodes that act only as an index. Leaves are linked in key order, so a range scan walks that chain and never returns to the index. Occupancy rules match a B-tree, and…
How a B-tree keeps every leaf at one depth
Short answer: A B-tree of minimum degree t stores between t−1 and 2t−1 keys in every node except the root, and every leaf sits at the same depth. Search follows one child pointer per node, so a tree of n keys has height O(log_t n). Insert splits a full…
How 0-1 knapsack fills a capacity row
Short answer: The 0-1 knapsack problem takes each item at most once. With capacity W and n items, the cell dp[i][w] is the best value using the first i items and capacity w. The item is skipped, or it is taken when its weight fits, and the cell is…
How 0-1 BFS uses a deque for weights zero and one
Short answer: 0-1 BFS computes shortest paths when every edge weight is 0 or 1. A relaxation of weight 0 pushes the neighbor at the front of a deque, and a relaxation of weight 1 pushes it at the back. The front of the deque stays in distance order,…
How mergesort keeps a stable n log n bound
Short answer: Mergesort splits the array in half, sorts each half, and merges with two pointers. Ties take the left element, so equal keys keep their original order. Every level does Θ(n) work and there are Θ(log n) levels, which fixes the worst case at Θ(n log n) comparisons.…
How four petals in a circle draw a bronze mirror in SVG
Short answer: The mirror is two circles and four petals. The petals are one closed curve, copied by turning it a quarter turn about the center. A small circle in the middle is the knob. The ink is #161616, and nothing is filled. The drawing is a type of…
How a deep bowl on a flared foot draws a stemmed dou in SVG
Short answer: The dou is a stemmed bowl seen from the side. The mouth is an ellipse, the bowl is one cubic, the stem is two vertical strokes, and the foot is a second cubic. A lighter wave inside the bowl stands in for a petal. The ink is…
How one spiral and two lugs draw a painted jar in SVG
Short answer: The jar is an ellipse for the mouth, one path for the body, a trapezoid for the foot, and a lug on each side. The painted part is two bands, one spiral, and a single filled dot. The dot is the only fill. The ink is #161616.…



