12.5 Discrete math 2 problem set, part b: trees, birthday bounds, MinHash and LSH, Bloom filters, recurrences
The data structures that the corpus pipeline and the tokenizers stand on each have a number that must be chosen before they run. The trie of Trees and tries, longest-prefix match is a tree whose size can be predicted. The A Bloom filter in Programming and Algorithms, which Exact dedup: paragraph hashes, a Bloom screen, and a sort-merge confirm in Data Engineering uses to drop exact duplicates, needs a bit budget and a hash count; pick them by feel and the filter is ten times leakier than it needs to be, silently. The near-duplicate stage, Near-duplicate dedup: MinHash, LSH, union-find, and decontamination, splits 128 MinHash values into 16 bands of 8 rows, which decides at what similarity two documents get compared at all; the wrong split either compares everything or misses the near-copies. And the hash tables keyed by 32- or 64-bit hashes need to know when collisions start.
Concepts from other sections (18)
This section uses these ideas. Each has a short definition and a link to the section that explains it in full. Tap a dotted term in the text to preview it.
- Trie: a rooted tree whose edges carry characters so that each node spells the string on its path. Read more: 12.2 Trees and tries, longest-prefix match
- Characteristic equation (recurrences): for a linear recurrence , the equation ; with distinct roots the closed form is . Read more: Chapter 12: Discrete Math 2
- Generating function: the power series whose coefficients are a sequence; algebra on solves counting problems and recurrences. Read more: Chapter 12: Discrete Math 2
- Power series: a series in powers of ; it converges for less than its radius of convergence and can diverge beyond it. Read more: Chapter 8: Calculus 2
- Connected graph: a graph with a path (a sequence of distinct vertices, each joined to the next by an edge) between every pair of vertices; a tree is a connected graph with no cycles. Read more: Chapter 12: Discrete Math 2
- Complete binary tree: a tree with every level full except possibly the last, which is filled left to right; it is what makes the array layout work. Read more: 18.4 Binary heap in Programming and Algorithms
- Binary heap: a complete binary tree in an array in which no child comes out before its parent. Read more: 15.6 A binary heap with lazy deletion in Programming and Algorithms
- Linearity of expectation: , which holds even when and are dependent; it is the main tool for analysing randomized algorithms, such as the coupon collector’s expected draws. Read more: Chapter 13: Probability and Statistics
- Variance: the expected squared distance from the mean; its square root is the standard deviation. Read more: 13.1 Random variables, expectation, variance, and normal draws by Box-Muller
- Divide and conquer / divide-and-conquer: an algorithm design that splits a problem into independent subproblems, solves them recursively, and combines their results; unlike dynamic programming the subproblems do not overlap, and the gain comes from better asymptotics, as in merge sort. Read more: Chapter 13: Recursion and divide-and-conquer in Programming and Algorithms
- Huffman tree: the binary tree Huffman’s algorithm builds, with each character at a leaf; a character’s code is its path from the root, 0 for a left branch and 1 for a right one, so frequent characters sit near the root and get short codes. Read more: 10.1 Huffman coding in Programming and Algorithms
- Base case: an input on which a recursive function returns directly without calling itself; together with an input that strictly shrinks on every call, it guarantees that the recursion terminates. Read more: Chapter 13: Recursion and divide-and-conquer in Programming and Algorithms
- Induction hypothesis: the assumption used to prove . Read more: 11.3.4 Relations, functions, and validation
- Bijection: a function that is both injective and surjective, and so has an inverse. Read more: 11.3.4 Relations, functions, and validation
- Injective: no two inputs share an output; for a dict, no value appears twice. Read more: 11.2 Injective, surjective, bijective: the GPT-2 byte map
- MinHash signature: the minima of hash functions over a document’s shingles; equal entries estimate Jaccard. Read more: 5.4 Near-duplicate dedup: MinHash, LSH, union-find, and decontamination in Data Engineering
- Standard deviation: , the typical distance of a random variable from its mean, in the same units as the variable itself. Read more: Chapter 13: Probability and Statistics
- roofline: the bound on a loop’s speed from peak compute , memory bandwidth , and arithmetic intensity . Read more: 22.3 Cache-blocked, packed, batch-invariant matmul in C in AI Engineering
None of these mistakes raises an error. This problem set derives the formulas, so that the parameters in the solution code are calculations rather than guesses. It is a pen-and-paper set with no code to write: 26 problems with answers (27 parts in all) and 3 proofs. Problems 19 to 22 size a Bloom filter, Problems 13 to 18 set up MinHash and LSH bands, and Problem 28 gives the cost of the tiled matmul in Cache-blocked, packed, batch-invariant matmul in C.
You should have worked part a of the problem set (graphs, hashing, expected collisions) and read the trie section and the chapter opening. The review below derives every formula the problems use and works a Bloom filter, an LSH curve, and a proof by hand. Every problem is then followed by a collapsed worked answer with the final result or a complete model proof, together with the common wrong answers and why they are wrong. Try each problem before opening its answer.
Learning objectives
- Count the edges, internal nodes, and trie nodes of a tree, and prove that a tree on nodes has edges.
- Use inclusion-exclusion and birthday bounds to predict when hashed keys start to collide.
- Prove that MinHash estimates Jaccard similarity, and read the threshold of an LSH S-curve from its bands and rows.
- Derive the optimal number of Bloom filter hashes and the bits per key for a target false-positive rate.
- Solve recurrences by unrolling, by the characteristic equation, and with generating functions.
Trees and counting
Section titled “Trees and counting”The notation is shared by the review and the problems.
| Symbol | Meaning | Type / shape |
|---|---|---|
| the number of nodes of a tree, of keys in a filter, or the size of a recurrence’s input | int | |
| the number of elements of a finite set | int | |
| the number of buckets of a hash, or of bits of a Bloom filter | int | |
| the number of keys hashed (birthday), or of hash functions per key (Bloom) | int | |
| the Jaccard similarity of two non-empty sets | float in | |
| a uniformly random permutation of the universe | permutation | |
| , | the LSH bands and rows per band, = signature length | int |
| the probability that one MinHash row agrees (the pair’s Jaccard similarity) | float | |
| the cost of a recursive algorithm on input size | function | |
| the ordinary generating function of a sequence | formal power series |
A tree is a connected graph with no cycle. Between two of its nodes there is exactly one path; it has exactly edges (Problem 6 asks for the proof); and a tree with at least two nodes has at least two leaves. Rooting it makes every non-root node the child of exactly one parent. In a full binary tree every internal node has two children, so counting edges two ways, with , gives . A complete binary tree of nodes is the shape of a binary heap (node has children and ), and its height is . Cayley’s formula counts the trees on labelled nodes: .
Counting unions needs one more tool. Inclusion-exclusion says: to count a union, add the sizes, subtract every pairwise overlap (counted twice), add back every triple overlap (subtracted once too often), and so on:
The same alternating sum over the events “element is fixed” counts derangements.
Birthday bounds
Section titled “Birthday bounds”Counting turns into probability as soon as keys are hashed. Hash keys uniformly into buckets. The keys are all in different buckets with probability : the -th key must avoid the occupied buckets. Using , this is at most . Each of the pairs collides with probability , so by linearity of expectation the expected number of colliding pairs is , and by the union bound that is also an upper bound on the probability of any collision. All three say the same thing: collisions start at .
Jaccard similarity and MinHash
Section titled “Jaccard similarity and MinHash”Collisions are usually the enemy; MinHash turns them into a measurement. Two documents are sets of shingles (overlapping substrings), and their similarity is the Jaccard similarity . Apply a random permutation to the universe and keep the minimum of each set. Among , the element with the smallest value is equally likely to be any of the elements, and the two minima agree exactly when it lies in . So (Problem 14). With independent permutations, the fraction that agree is an unbiased estimate of with variance , the variance of a mean of Bernoulli variables. The near-duplicate stage stands in for permutations with seeded hash functions.
LSH banding
Section titled “LSH banding”Estimating every pair’s similarity is still too expensive: comparing every pair of documents is comparisons. Instead, split each signature into bands of rows and hash each band; two documents become candidates when they agree on every row of some band. With per-row agreement , one band agrees with probability and fails with , all fail with , so
As a function of this is an S-curve: near 0 for dissimilar pairs, near 1 for similar ones, rising most steeply around . More rows per band push the threshold up and sharpen the curve; more bands pull it down.
Bloom filters
Section titled “Bloom filters”A Bloom filter answers “have I seen this key?” in a fixed number of bits. It is bits, all 0. Inserting a key sets the bits its hashes point to. A lookup reports “present” when all of its bits are set, so it never misses an inserted key, and it reports a false positive when an absent key finds all its bits set by others. After insertions one bit is still 0 with probability . Treating the probed bits as independent (an approximation, accurate for large ), the false-positive rate is
Write for the fraction of zero bits, so and . That is symmetric under and is smallest at : the best filter has half its bits set, , and . Solving for the bits per key gives .
Recurrences
Section titled “Recurrences”The last topic is cost. A recurrence defines a sequence by its earlier terms, and there are three standard ways to solve one:
- Unroll and sum. unrolls to . For each of the levels of the recursion costs in total.
- Characteristic equation. For try : then . With distinct roots the general solution is , and the two initial values fix and .
- Generating functions. Multiply the recurrence by and sum, and it becomes an equation for . The basic pair is , and differentiating it gives .
For divide-and-conquer costs , compare with . The leaves dominate when , giving , which is why 8 half-size matrix products cost and Strassen’s 7 cost .
Working three examples by hand
Section titled “Working three examples by hand”The three examples here are siblings of the problems, not answers to them. Start by sizing a Bloom filter at 8 bits per key. The optimal number of hashes is . A filter needs an integer, so compare the neighbours with :
| 5 | 0.5353 | 0.4647 | 0.02168 |
| 6 | 0.4724 | 0.5276 | 0.02158 |
is (barely) better, giving about 2.16% false positives. At the real-valued optimum the rate would be . For 1% you need bits per key.
Next, read an LSH S-curve with 20 bands of 5 rows. The threshold is . At : , a band fails with , all 20 fail with , so the pair becomes a candidate with probability . At : , , so only . Similar pairs are almost always compared and dissimilar ones rarely.
Finally, a model proof. Claim: a full binary tree with leaves has internal nodes. Method: strong induction on . Base: is a single node, which is a leaf, with 0 internal nodes. Step: let and assume the claim for every full binary tree with fewer than leaves. The root is internal (a leaf root would mean ), so it has two subtrees, each a full binary tree, with and leaves, , so each has fewer than . By the hypothesis they have and internal nodes. Adding the root: . So every full binary tree with leaves has internal nodes. Every symbol is defined, the hypothesis is used for the subtrees and not for the tree itself, and the last line restates the claim: the model proofs of Problems 6 and 29 have the same shape.
How the problems work
Section titled “How the problems work”Answers are exact where the problem says so; otherwise a closed form is given together with a decimal to the stated precision. log means the natural logarithm, and . Lettered parts share one answer block. The tag after each problem says what kind of answer is expected.
Problems on trees
Section titled “Problems on trees”The first six problems count edges, trie nodes, internal nodes, labelled trees, and heap heights, and finish with the proof that a tree on nodes has edges.
Problem 1. A tree has 12 nodes. How many edges does it have? [number]
Answer
. A tree on nodes has edges (Problem 6): every non-root node has exactly one edge to its parent. This is how a parent array or a trie arena sizes itself. Common mistakes: 12 gives every node an edge, including the root; 66 is the complete graph.
Problem 2. Build the trie of Trees and tries, longest-prefix match for the five keys car, cart, care, cat, dog. How many nodes does it have, counting the root? [number]
Answer
. Count distinct prefixes plus the root. Under c: c, ca, car, then cart, care, and cat (6 nodes). Under d: d, do, dog (3 nodes). With the root: . Shared prefixes are stored once, which is what makes a trie small. Common mistakes: 18 is 1 plus the 17 characters of the keys, with no sharing; 9 forgets the root.
Problem 3. A full binary tree is a rooted tree in which every node has either 0 or 2 children. One has 10 leaves. How many internal (non-leaf) nodes does it have? [number]
Answer
. In a full binary tree, internal leaves (the model proof worked by hand above). Counting edges two ways: , so . A BPE merge tree and a Huffman tree have this shape. Common mistakes: 10, and 19, which is the total number of nodes.
Problem 4. How many different trees are there on the 5 labelled nodes ? (Two trees differ when some pair of nodes is joined in one and not in the other.) [number]
Answer
. Cayley’s formula, . Common mistakes: counts orderings, and is , the count of rooted trees.
Problem 5. A complete binary tree fills every level except possibly the last, and fills the last level from the left. One has nodes. What is its height, the number of edges on its longest root-to-leaf path? [number]
Answer
. The height of a complete binary tree with nodes is : levels 0 to 5 hold nodes, and the remaining 37 sit on level 6. A common mistake is 7, which counts levels instead of edges.
Problem 6. Prove that every tree with nodes has exactly edges. [proof]
Answer
Claim. A tree is a connected graph with no cycle. For every , every tree with nodes has exactly edges.
Lemma (a leaf exists). A tree with nodes has a node of degree 1. Since is connected and has at least two nodes, it has an edge, so paths of length at least 1 exist. Take a longest path (paths have no repeated nodes, so there are finitely many). The end is adjacent to . If had another neighbour , then either for some , and is a cycle, which a tree does not have; or is off the path, and is a longer path, contradicting the choice. So has degree 1.
Lemma (removing a leaf leaves a tree). Let be a leaf of with its one edge , and let . has no cycle, because every cycle of is a cycle of . is connected: for nodes , the path from to in cannot pass through , since an interior node of a path needs two distinct path neighbours and has only one. So that path lies in .
Proof (induction on ). Base case : a single node has no edge, since an edge would need a second endpoint (and a loop is a cycle). So it has edges.
Inductive step: let and assume every tree with nodes has edges. Let be a tree with nodes. By the first lemma it has a leaf ; by the second, is a tree with nodes, and it has exactly one edge fewer than (the edge ). The induction hypothesis applied to gives edges for , so has edges. By induction the claim holds for every .
Model proof also in q6.md.
Problems on inclusion-exclusion and birthday bounds
Section titled “Problems on inclusion-exclusion and birthday bounds”These problems count unions and derangements, then turn to the probability that hashed keys collide and how many keys it takes.
Problem 7. Three sets have , every pairwise intersection has 3 elements, and . Give . [number]
Answer
. . A common mistake is 21, which forgets to add the triple intersection back: an element in all three sets is added 3 times and subtracted 3 times, so it must be added once more. 30 makes no correction at all.
Problem 8. How many integers in are divisible by 2, 3, or 5? [number]
Answer
. Let be the multiples of . ; pairwise ; triple . Total . Common mistakes: 103 is the plain sum, and 71 forgets to add back.
Problem 9. A derangement of is a permutation that moves every element. How many are there? [number]
Answer
. Inclusion-exclusion over the events “element is fixed”: . Common mistakes: 24 is every permutation; 8 drops the last term.
Problem 10. Three keys are hashed independently and uniformly into buckets. Give the exact probability that all three land in different buckets. [number] (exact)
Answer
. The second key must avoid one bucket and the third two: . Common mistakes: subtracts the union bound on a collision, which is only an upper bound; is the complement, the probability of at least one collision.
Problem 11. keys are hashed independently and uniformly into buckets. Give the expected number of unordered pairs of keys that share a bucket, as a formula in and . [expr] (variables k, m)
Answer
. There are unordered pairs, each colliding with probability , and expectation is linear. Common mistakes: and count ordered pairs (and the first also self-pairs).
Problem 12. Using , find the at which a collision becomes as likely as not, for a 32-bit hash (). [number] (to 3 significant digits)
Answer
(). Set : , . So a 32-bit hash collides after about 77,000 keys, not 4 billion. Common mistakes: drops the constant , and (half the table) is the intuition the birthday bound refutes.
Problems on Jaccard, MinHash, and LSH
Section titled “Problems on Jaccard, MinHash, and LSH”This group computes Jaccard similarities, proves the MinHash property, and reads the LSH S-curve for the banding used in near-duplicate detection.
Problem 13. Give the Jaccard similarity of the shingle sets and . [number] (exact)
Answer
. (3 elements), (6), so . Common mistakes: divides by and by ; neither is symmetric in and .
Problem 14. Let and be non-empty subsets of a finite universe and a uniformly random permutation of . Prove that . (This is why one MinHash value per permutation is an unbiased estimate of Jaccard similarity.) [proof]
Answer
Claim. Let be non-empty subsets of a finite universe and a uniformly random permutation of (a bijection ). Then , which is the Jaccard similarity .
Proof. Let be the element of with the smallest value ; it is well defined because is non-empty and is injective. For a uniform every ordering of is equally likely, and by symmetry each of the elements is equally likely to be first. So is uniformly distributed over .
Now compare the two minima. when , because no element of has a smaller value; likewise when .
- If , both minima equal , so they are equal.
- If , then , while every element of differs from and has a larger value, so and the minima differ. The case is symmetric.
So the minima are equal exactly when , and
Hence the indicator that one MinHash position agrees has mean : it is an unbiased estimate of the Jaccard similarity.
Model proof also in q14.md.
Problem 15. A MinHash signature with 128 independent permutations estimates by the fraction of the 128 positions that agree. Each position agrees with probability , independently. Give the variance of the estimate when . [number] (exact)
Answer
. The estimate is a mean of 128 independent Bernoulli() variables, so its variance is , a standard deviation of about 0.044. Common mistakes: , and , which forgets the factor .
Problem 16. LSH splits a signature into bands of rows; two documents become a candidate pair when all rows of at least one band agree. Each row agrees with probability (their Jaccard similarity), independently. Give the probability that they become candidates for , (the defaults of the near-duplicate stage in Data Engineering), as a formula in . [expr] (variable s)
Answer
. One band (8 rows) agrees with probability , fails with ; all 16 bands fail with ; the pair is a candidate unless they all fail. Common mistakes: swaps bands and rows, and swaps AND and OR (it would require every band to have at least one agreeing row).
Problem 17. The S-curve of Problem 16 rises most steeply near the threshold . Give for , . [number] (to 3 significant digits)
Answer
(). . So with the near-duplicate stage’s defaults, pairs above about 0.7 similarity are likely to be compared. Common mistakes: forgets the -th root, and guesses.
Problem 18. With , , give the probability that two documents with become candidates. [number] (to 6 significant digits)
Answer
(). , a band fails with , so the pair is a candidate with probability . Common mistakes: is the union bound over bands, close but not the probability; is one band.
Problems on Bloom filters
Section titled “Problems on Bloom filters”The Bloom problems derive the false-positive rate, the optimal number of hashes, and the bits per key needed for a target rate.
A Bloom filter has bits, holds keys, and sets bits per key with independent uniform hashes. A lookup of a key that was never inserted is a false positive when all of its bits are set.
Problem 19. Give the standard approximation of the false-positive rate, using , as a formula in , , and . [expr] (variables k, n, m)
Answer
. After bit-settings, one bit is still 0 with probability , so set with . A false positive needs all probed bits set: raise to the -th power. Common mistakes: sets only one bit per key, and probes one bit.
Problem 20. The rate of Problem 19 is smallest at . Give this optimal for 10 bits per key (), before rounding to an integer. [number] (to 6 significant digits)
Answer
(). Directly from . Common mistakes: inverts the factor, and 7 rounds before it was asked (a real filter does round, and compares the neighbours as in the Bloom example worked by hand above).
Problem 21. At the optimal of Problem 20 every bit is set with probability . Give the false-positive rate at that . [number] (to 6 significant digits)
Answer
(). With half the bits set, each probe hits a set bit with probability , so , about 0.82%. Common mistakes: uses bits per key as the number of hashes, and rounds first.
Problem 22. With the optimal , the bits per key needed for a target false-positive rate are . Give for . [number] (to 6 significant digits)
Answer
(). , and . So 1% needs about 9.6 bits per key, with hashes. Common mistakes: is , not bits per key, and a filter sized at 6.6 bits per key misses its target; 100 confuses the rate with its reciprocal.
Problems on recurrences and generating functions
Section titled “Problems on recurrences and generating functions”The last group solves recurrences by unrolling, by the characteristic equation, and with generating functions, and closes with a proof of the merge-sort cost.
Problem 23. Solve with for a power of 2. [expr] (variable n)
Answer
. Unroll: the recursion has levels, and level has subproblems of size , each costing , so every level costs . The leaves cost . Problem 29 proves it by induction. Common mistakes: uses the natural log, off by a factor ; ignores the halving.
Problem 24. Solve with . [expr] (variable n)
Answer
. Unroll: . Common mistakes: keeps only the leading term, and is off by one (it stops at ).
Problem 25. Solve with and . [expr] (variable n)
Answer
. Characteristic equation , roots 1 and 2, so . gives ; gives , so , . Check: . Common mistakes: and ignore the initial values.
Problem 26. Give the ordinary generating function of the sequence (that is, ) in closed form. [expr] (variable x)
Answer
. Differentiate : . Common mistakes: is the sequence of all 1s, and generates , not .
Problem 27. How many binary strings of length 10 contain no two consecutive 1s? [number]
Answer
. Let count the valid strings of length . A valid string ends in 0 (anything valid of length before it) or in 01 (anything valid of length ): , with , . So : . Common mistakes: 89 is , off by one; 1024 counts every string.
Problem 28. Recursive matrix multiplication splits each matrix into four blocks. (a) The plain method does 8 half-size products and additions: . Give the exponent with . (b) Strassen’s method does 7: . Give . [number]
Answer
(a) , (b) . Compare with . (a) : the leaves dominate, . (b) : . Common mistakes: 2 for (a) reads the cost of the additions; 3 for (b) ignores that one fewer product changes the exponent; uses the wrong base.
Problem 29. Prove by induction that with gives for every that is a power of 2. [proof]
Answer
Claim. Let and for a power of 2. Writing , we prove for every integer , which is for every power of 2.
Base case . .
Inductive step. Assume for some . Since , the recurrence applies with and :
By the hypothesis , so
This is the claim for . By induction for all , and with this reads .
Model proof also in q29.md.
What can go wrong
Section titled “What can go wrong”Each common mistake in this set shows up as a wrong answer to a specific problem. The table collects them, with the symptom in a real system and the habit that avoids it.
| Pitfall | Symptom | How to avoid it |
|---|---|---|
| Counting a trie as one node per character | sizes a node arena for the worst case, ignoring shared prefixes | count distinct prefixes plus the root (Problem 2) |
| Forgetting to add back the triple overlap | a union undercounted by every element in all three sets | alternate signs through every intersection size, including the triple (Problems 7, 8) |
| Reading the union bound as the probability | “1 - 3/10” instead of the exact product | multiply the exact per-step probabilities; use the union bound only as a bound (Problems 10, 18) |
| Expecting collisions only near a full table | a 32-bit-keyed cache that collides after 77 000 entries, not 4 billion | solve : (Problem 12) |
| Dividing the overlap by one set’s size | a similarity that is not symmetric and overstates small documents | divide by the union, which is symmetric (Problem 13) |
| Swapping bands and rows, or AND and OR | the S-curve’s threshold lands far from the intended similarity | AND within a band (), OR across bands () (Problem 16) |
| One hash per Bloom key, or a single probe | a false-positive rate formula off by orders of magnitude | count bit-settings and probes (Problem 19) |
| Confusing with bits per key | a filter sized at 6.6 bits per key that misses its 1% target | keep apart from (Problem 22) |
| Natural log where is meant | costs off by a factor of | write explicitly, since the recursion halves (Problem 23) |
Where this leads
Section titled “Where this leads”Looking back, this set extends the expected colliding pairs (Problem 17) and modular hashing of part a of the problem set to birthday bounds, and Problem 2 predicts the node count of the trie in Trees and tries, longest-prefix match. Looking forward, Bloom::with_rate(n, p) in the A Bloom filter section of Algorithms computes and with Problems 20 to 22. The MinHash signatures of 128 values in 16 bands of 8 rows in Near-duplicate dedup: MinHash, LSH, union-find, and decontamination are analysed by Problems 15 to 18. And the cost and roofline of the tiled matmul in Cache-blocked, packed, batch-invariant matmul in C use the recurrence of Problem 28.
Further reading
Section titled “Further reading”- Leskovec, Rajaraman, and Ullman, Mining of Massive Datasets, chapter 3 (MinHash, LSH).
- Broder and Mitzenmacher, “Network Applications of Bloom Filters: A Survey” (2004).
- Graham, Knuth, and Patashnik, Concrete Mathematics, chapter 7 (generating functions).
Key terms
Section titled “Key terms”- Full binary tree: a rooted tree in which every node has 0 or 2 children; it has one fewer internal node than leaves.
- Inclusion-exclusion: counting a union by alternately adding and subtracting the sizes of intersections.
- Birthday bound: the observation that keys in buckets start to collide at .
- Jaccard similarity: .
- MinHash: estimating Jaccard similarity by how often the minima of random permutations agree.
- LSH banding: splitting a signature into bands of rows so that pairs agreeing on some whole band become candidates.
- Bloom filter: a bit array with hashes per key that never misses an inserted key and has a tunable false-positive rate.
- Recurrence: a definition of a sequence in terms of its earlier terms.
Summary
Section titled “Summary”- A tree on nodes has edges, and a trie stores each shared prefix once, so its size is one more than the number of distinct prefixes (Problems 1, 2, 6).
- Collisions arrive at about keys, not : a 32-bit hash is likely to collide after about 77 000 keys (Problems 11, 12).
- One random permutation’s minimum agrees on two sets with probability exactly their Jaccard similarity, and banding MinHash rows turns that into an S-shaped candidate probability with its threshold near (Problems 14, 16 to 18).
- A Bloom filter with bits per key is best with hashes, which sets half its bits and gives a false-positive rate of (Problems 20 to 22).
- Divide-and-conquer costs follow from their recurrences: is , and 8 half-size products cost (Problems 23, 28, 29).
- Model proofs for Problems 6, 14, and 29 are also in
course/solutions/solve/S-M06b/.