brain

tamnd's digital brain — notes, problems, research

41641 notes

TAOCP 6.4 Exercise 51

Let $X(a,n)$ denote the random variable whose expectation is $R(a,n)$ as defined in (55).

taocpmathematicsalgorithmsvolume-3
TAOCP 5.3.2 Exercise 16

Let $H(m,n)$ denote the number of comparisons performed by Hwang and Lin’s binary merging algorithm when merging $A_1<\cdots<A_m$ with $B_1<\cdots<B_n$ under worst-case behavior.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.4 Exercise 60

Let $M$ be the table size and let $n$ keys be stored, with load factor $\alpha = \frac{n}{M}.$ A single-hashing scheme assigns to each key $K$ a home address $h(K)\in{0,\dots,M-1}$, and associates wit...

taocpmathematicsalgorithmsvolume-3math-research
TAOCP 5.4.8 Exercise 6

The reviewer is correct that the previous argument failed at the single-trajectory constraint.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 6.2.2 Exercise 13

We restart from the permutation model, since this avoids any circular use of symmetry or exchangeability.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 6.2.2 Exercise 29

Let the 31 keys be the most common English words in Fig.

taocpmathematicsalgorithmsvolume-3project
TAOCP 6.2.1 Exercise 17

Let the Fibonacci tree of order $k$ be defined as usual: a node of order $t$ has a left child of order $t-1$ and a right child of order $t-2$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.2.3 Exercise 28

A 2-3 tree is a rooted ordered tree in which every internal node has either two or three children and contains respectively one or two keys, and in which all external nodes occur at the same level.

taocpmathematicsalgorithmsvolume-3project
TAOCP 6.2.1 Exercise 5

We restart from the correct inequality and determine the full integer solution set carefully.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.4.8 Exercise 8

We restart from the definition of the condition and first extract its actual global consequence, instead of interpreting it geometrically.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.1.3 Exercise 6

The mistake is that Mr.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.2.2 Exercise 15

We reanalyse the process without symmetry shortcuts that are not grounded in the algorithm, and we reduce everything to an explicit counting over induced insertion orders on the final 3-key tree.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.3.3 Exercise 6

We give a complete proof consisting of a tight upper bound (algorithm) and a correct adversary lower bound.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.2 Exercise 25

The main issue in the previous solution is that it never uses a usable structural form of the relation.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.2.1 Exercise 7

Let $a_1 a_2 \dots a_n$ be a random permutation of ${1,2,\dots,n}$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.2.4 Exercise 3

The modification introduces an additional equality case in the comparison step of Algorithm M so that records from the first file are omitted whenever their keys also occur in the second file.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.3.2 Exercise 12

We restart the argument cleanly and avoid any reliance on incorrect monotonicity substitutions.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.1.4 Exercise 1

Let \begin{pmatrix} a_1&a_2&\cdots&a_9\\ b_1&b_2&\cdots&b_9 \end{pmatrix}

taocpmathematicsalgorithmsvolume-3
TAOCP 5.4.1 Exercise 26

The argument fails because it replaces the algorithm of Exercise 25 with an unrelated Touchard model and then manipulates that model without any link to run termination.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.4.2 Exercise 5

Let f_p(z)=z^p-z^{p-1}-\cdots-z-1,\qquad p>2, and define

taocpmathematicsalgorithmsvolume-3hm-hard
TAOCP 5.2.1 Exercise 5

**Exercise 5.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.4.2 Exercise 19

The previous solution fails because it replaces the actual construction of Caron’s polyphase schedule with an unproven symmetry argument.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.1 Exercise 22

Let $R_1,\dots,R_N$ be the file and let $d(K_i,A)$ be the distance from record $R_i$ to the given argument $A$.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.2 Exercise 30

Let $T=P+1\ge 3$ tapes be given.

taocpmathematicsalgorithmsvolume-3project
TAOCP 5.4.1 Exercise 20

We restart from a correct model of TAOCP replacement selection (“natural selection”) and avoid any assumption of independence or uniform heap ranks.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.3 Exercise 42

Let $K_1, K_2, \dots, K_r$ be the binary keys, each a finite string over ${0,1}$, and let $T$ be the binary trie formed by these keys.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.7 Exercise 3

Let $T \ge 4$ tapes be available.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.3.3 Exercise 13

We restart the argument from the definition used in this section of TAOCP, where $V_r(n)$ denotes the generalized power sum V_r(n) = \sum_{k=1}^n k^r, extended to complex $r$ by analytic continuation.

taocpmathematicsalgorithmsvolume-3math-research
TAOCP 6.1 Exercise 7

The probability distribution (5) is p_k = 2^{-k}\quad (1 \le k \le N-1), \qquad p_N = 2^{-(N-1)}.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.4 Exercise 59

Let $S_M$ be the set of all permutations of $\{0,1,\dots,M-1\}$, and let $\mathbb{P}$ be a probability assignment on $S_M$ that is equivalent to uniform probing in the sense of Theorem U.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.4.6 Exercise 10

Let $S$ be the total number of runs in the file.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.2.2 Exercise 31

Let C^*(w)=\min_T \sum_{v} w_v d_v(T) be the optimal alphabetic tree cost for the ordered weight sequence

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 6.4 Exercise 61

The error in the previous solution is the assumption that column-wise uniformity of the permutations implies optimality of all coefficients $c_k$.

taocpmathematicsalgorithmsvolume-3math-research
TAOCP 6.1 Exercise 20

The previous solution failed because it tried to analyze the function $\delta(t)=d(t,i)-d(t,i+1)$ directly on the cycle, where it is not monotone and in fact has multiple regime changes.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.4.3 Exercise 10

Let $A_n, B_n, C_n, D_n, E_n$ be the cascade sequences of Section 5.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.2 Exercise 1

Algorithm C still works if $i$ varies from $2$ up to $N$ in step C2 instead of from $N$ down to $2$, because the comparisons made in step C4 depend only on the relative ordering of $K_i$ and $K_j$, no...

taocpmathematicsalgorithmsvolume-3
TAOCP 5.4.7 Exercise 1

The core mistake in the previous argument is the attempt to manufacture a per-level varying radix structure from tape-role behavior.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.4 Exercise 20

In the modified Algorithm D, step D3 sets c\leftarrow0, and each time step D4 is entered, the counter is first increased:

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.4 Exercise 6

In MIX arithmetic, the instruction `DIV d` interprets the concatenation $AX$ as a single signed integer formed with $A$ as the high-order word and $X$ as the low-order word.

taocpmathematicsalgorithmsvolume-3simple
TAOCP 6.2.1 Exercise 26

A correct proof must specify an invariant state of the polyphase algorithm and show that this invariant is exactly the Fibonacci decomposition encoded by Fibonacci trees.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.4 Exercise 65

Let a variable-length key $K$ be a finite sequence of MIX characters $K = c_1 c_2 \dots c_\ell,$ where each $c_i$ is an element of a fixed alphabet of radix $r$ (for MIX, typically $r = 64$ or $r = 10...

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.2 Exercise 16

Let $P = T-1 \ge 2$.

taocpmathematicsalgorithmsvolume-3hm-project
TAOCP 6.2.2 Exercise 24

Let $T$ be a binary search tree with cost C(T)=\sum_{i=1}^n p_i\,\mathrm{depth}(k_i)+\sum_{i=0}^n q_i\,\mathrm{depth}(d_i), where all $p_i,q_i\ge 0$ and $p_n=q_n=0$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.3.1 Exercise 5

The previous solution fails because it treats the problem as one of extracting information from a fixed probabilistic comparison outcome, whereas the task is a deterministic decision problem in the co...

taocpmathematicsalgorithmsvolume-3
TAOCP 5.4.1 Exercise 9

Let the comparison used in Algorithm R for the selection tree be denoted by $\prec$, where in the original algorithm $a \prec b$ means that key $a$ is smaller than key $b$.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.3 Exercise 21

Let $M \ge 2$ and consider a random $M$-ary trie built from $N$ keys, where each digit of each key is independently uniformly distributed in ${0,1,\dots,M-1}$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.4 Exercise 49

Let $K$ be the number of records in a fixed bucket.

taocpmathematicsalgorithmsvolume-3hm-medium
TAOCP 6.2.3 Exercise 22

Let a weight-balanced tree be a binary tree in which there exists a fixed constant $0 < \alpha \le \tfrac{1}{2}$ such that for every internal node $v$ with subtree size $n(v)$, its left and right subt...

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.1.4 Exercise 5

We give a complete corrected proof by isolating the precise mechanism that guarantees both row and column inequalities during each bumping operation, without circular reasoning.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.4.2 Exercise 26

Let $T=4$, so $P=T-1=3$ and the tape-splitting polyphase merge uses the 3-way Fibonacci system defined by the third-order recurrence F_n = F_{n-1}+F_{n-2}+F_{n-3}\quad (n\ge 3), with initial values de...

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.4 Exercise 53

The error in the proposed solution occurs at the change of variables and the resulting failure to preserve the structure needed for an incomplete gamma representation.

taocpmathematicsalgorithmsvolume-3hm-medium
TAOCP 5.4.2 Exercise 24

The error in the previous solution is not the use of Perron–Frobenius itself, but the attempt to justify it through an incorrect state-space model.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.4.1 Exercise 5

A selection tree used for replacement selection represents $P$ external nodes as the leaves of a complete binary tree, with internal nodes storing comparison results along the path to the root.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.4.2 Exercise 10

Let ${F_n^{(p)}}_{n\ge 0}$ denote the $p$th-order Fibonacci numbers defined in Section 5.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.2.5 Exercise 1

The distribution sort of Exercise 5.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.2.1 Exercise 23

Let the given search algorithm be represented by a finite decision tree $T$.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.3 Exercise 4

Let $I(T)$ denote the internal path length of a tree $T$, defined as the sum of the depths of all internal nodes of $T$, where the root has depth $0$ and each child increases depth by $1$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.2.2 Exercise 6

Algorithm M (as used in Section 5.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.3 Exercise 28

Let $T_N$ be the Coffman–Eve $M$-ary digital search tree built from $N$ independent random infinite strings over an alphabet of size $M>2$.

taocpmathematicsalgorithmsvolume-3hm-hard
TAOCP 6.2.2 Exercise 11

We restart the counting from the actual behavior of step D3, since the previous argument misidentified what is being counted.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.4 Exercise 47

Let the table have size $M$, with $n$ stored keys and load factor $\alpha=n/M$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.1 Exercise 9

Let $p_k$ be probabilities on ${1,2,\dots,N}$ with $\sum_{k=1}^N p_k=1$.

taocpmathematicsalgorithmsvolume-3hm-hard
TAOCP 5.3.4 Exercise 2

Let $n$ be fixed and consider Pratt’s sorting network constructed from all 3-smooth numbers d = 2^i 3^j \le n.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.4 Exercise 16

The computation performed by Program L does not fail arithmetically when $K = 0$.

taocpmathematicsalgorithmsvolume-3simple
TAOCP 5.4.3 Exercise 11

The exercise statement is incomplete.

taocpmathematicsalgorithmsvolume-3math-project
TAOCP 6.2.2 Exercise 22

Let e[i,j]=\min_{k=i}^j\bigl(e[i,k-1]+e[k+1,j]+w[i,j]\bigr), \qquad r[i,j]\in\arg\min.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.2.2 Exercise 35

Let $p_{ij} = \Pr(X = x_i, Y = y_j)$, $p_i = \Pr(X = x_i) = \sum_j p_{ij}$, and $q_j = \Pr(Y = y_j) = \sum_i p_{ij}$.

taocpmathematicsalgorithmsvolume-3hm-medium
TAOCP 5.4.1 Exercise 3

We restart the analysis from the definition of **four-way replacement selection** (TAOCP §5.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.3.2 Exercise 3

We restart from the definitions of the two quantities in Knuth’s merging model.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.4.2 Exercise 6

Let F(z)=\frac{p(z)}{q(z)}, \qquad G(z)=\frac{p(z)}{q(z)^2}.

taocpmathematicsalgorithmsvolume-3hm-medium
TAOCP 5.4.2 Exercise 2

The previous solution failed because it replaced Algorithm D with an unproved “Fibonacci level” abstraction and then reasoned about dummy runs in that model.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.9 Exercise 14

Let a rooted ordered tree $T$ have $n$ leaves.

taocpmathematicsalgorithmsvolume-3project
TAOCP 6.2.2 Exercise 40

Let $T_n$ be a binary search tree built from a uniformly random permutation of $n$ distinct keys, so every BST shape consistent with in-order orderings occurs with the standard BST probability model.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 6.4 Exercise 2

The previous solution fails because it never executes the MIX program in Table 1 and never derives an actual address from the algorithm.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.9 Exercise 25

The correct way to rework the example is to stay inside TAOCP’s randomized striping model: each run is striped across the $Q$ disks by a fixed permutation of disk numbers, and successive blocks of a r...

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.2 Exercise 28

Let there be $T=6$ tapes, so $P=5$ input tapes and one output tape.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 6.3 Exercise 12

Let $T_n$ be a digital search tree constructed by Algorithm D from $n$ keys $K_1,\dots,K_n$, where the keys are independent infinite binary sequences with each bit independently $0$ or $1$ with probab...

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.4 Exercise 50

By equation (42), the quantity $Q_o(M,N)$ satisfies Q_o(M,N) = 1 + \frac{N}{M} Q_o(M,N-1).

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.1 Exercise 10

Let $p_1, p_2, \dots, p_N$ be the probabilities that the argument equals $K_1, K_2, \dots, K_N$, with $\sum_{i=1}^N p_i = 1$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.4 Exercise 52

From equation (42), $Q_o(M,N)$ is given by the finite sum Q_o(M,N)=\sum_{k=0}^{N} \binom{N}{k}\frac{k!

taocpmathematicsalgorithmsvolume-3hm-medium
TAOCP 5.3.1 Exercise 1

For $n>0$, the recurrence $P_n=\sum_{k=1}^{n} \binom{n}{k} P_{n-k}$ together with $P_0=1$ is multiplied by $z^n/n!$ and summed over all $n\ge 1$.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.2.3 Exercise 18

Unusual activity has been detected from your device.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.2 Exercise 8

Let $I_n$ denote the internal path length of the random BST built from $n$ keys.

taocpmathematicsalgorithmsvolume-3math-project
TAOCP 5.4.3 Exercise 2

We compare cascade sorting on three tapes (Algorithm C) with polyphase merging on three tapes (Algorithm 5.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.4 Exercise 69

The review identifies three genuine failures: an unjustified symmetry factor, an unsupported intermediate bound, and a mismatch between the run decomposition and the claimed inequality.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.1 Exercise 18

Let the positions be $1,2,\dots,N$.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 6.2.2 Exercise 10

Let the incoming keys be $K_1, K_2, \ldots, K_n$, arriving in an arbitrary order.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.1 Exercise 1

Let $l$ and $u$ be the current indices in Algorithm B (binary search on a sorted table $K_1 < \cdots < K_n$), with sentinels $K_0 = -\infty$ and $K_{n+1} = +\infty$.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.9 Exercise 7

Let each initial run $i$ have weight $w_i$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.1.3 Exercise 14

Let w = 3111231423342244 a word on $\{1,2,3,4\}$ having 5 runs (maximal weakly increasing consecutive blocks).

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.2.5 Exercise 2

Algorithm R performs a sequence of $p$ distribution passes, each pass grouping records into $M$ FIFO queues according to a single digit $a_{p+1-k}$.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.4 Exercise 42

Let $M$ be the number of hash addresses and let $n$ be the number of occupied cells at the moment a new key $K$ is inserted by Algorithm C.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.4.6 Exercise 8

Let the initial distribution place $S$ runs onto $P$ input tapes for a $P$-way merge under Algorithm F in Section 5.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.2 Exercise 28

The previous solution failed to align with TAOCP macro-language conventions because it relied on undefined return semantics and did not specify a formal output interface.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.9 Exercise 28

We restart from the definition of marking in the TAOCP model and avoid any auxiliary pipeline assumptions.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.4.3 Exercise 3

The earlier solution fails primarily because it never instantiates Algorithm C’s actual state mechanism: a 5-way polyphase merge on six tapes driven by a 5-term Fibonacci-type (pentanacci) distributio...

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.1.2 Exercise 11

**Exercise 5.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.4.8 Exercise 10

Let the multireel file consist of a sequence of records distributed over several reels, with no restriction on where a run begins or ends relative to reel boundaries.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.2 Exercise 37

Let $(P_1,\dots,P_n)$ be uniformly distributed over the simplex $P_k>0,\quad \sum_{k=1}^n P_k = 1.$ The entropy is $H(P_1,\dots,P_n) = -\sum_{k=1}^n P_k \log P_k.$ By symmetry, $\mathbb{E}[H(P_1,\dots...

taocpmathematicsalgorithmsvolume-3hm-hard
TAOCP 6.3 Exercise 9

The original attempt fails mainly because it mixes abstract register notation with MIX conventions and omits the actual pointer manipulation required by Algorithm D.

taocpmathematicsalgorithmsvolume-3medium