brain

tamnd's digital brain — notes, problems, research

43815 notes

TAOCP 6.2.3 Exercise 30

Let each available area be represented by a node $P$ with fields $\text{LOW}(P), \text{HIGH}(P), \text{SIZE}(P)=\text{HIGH}(P)-\text{LOW}(P)+1,$ and let all free areas be stored in a balanced binary t...

taocpmathematicsalgorithmsvolume-3hard
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 5.3.3 Exercise 9

We construct all values for $V_t(8)$ using a single consistent method: an optimal 8-element tournament followed by explicit optimal selection in the induced comparison structure.

taocpmathematicsalgorithmsvolume-3math-project
TAOCP 6.2.3 Exercise 21

The previous solution fails because it introduces unnecessary hierarchical structure that does not preserve the global constraint from Exercise 5.

taocpmathematicsalgorithmsvolume-3hard
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 6.3 Exercise 23

Let $N$ keys be stored in an $M$-ary trie under the uniform random model in which each digit of each key is independently uniformly distributed in ${0,1,\dots,M-1}$.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.2.1 Exercise 5

**Exercise 5.

taocpmathematicsalgorithmsvolume-3
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.9 Exercise 31

The previous solution fails because it never reconstructs the _actual performance quantity in TAOCP’s striping model_.

taocpmathematicsalgorithmsvolume-3hm-research
TAOCP 6.3 Exercise 34

The previous solution fails because it invents structure and singularities instead of deriving them from the actual expression in (18).

taocpmathematicsalgorithmsvolume-3hm-project
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 56

Let $n = Mb$.

taocpmathematicsalgorithmsvolume-3hm-project
TAOCP 5.5 Exercise 3

Let a file consist of $N$ records with totally ordered keys.

taocpmathematicsalgorithmsvolume-3research
TAOCP 6.2.4 Exercise 5

We correct the analysis by rebuilding the argument from the actual insertion model and then performing a genuine worst-case optimization over all valid full nodes and all valid splits.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.1.4 Exercise 8

**Exercise 5.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.4.2 Exercise 25

We restart from the correct structure of a 4-tape polyphase merge.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.2.1 Exercise 9

The flaw in the previous solution is that it never uses the data in Tables 3 and 4.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.2 Exercise 1

Let $A$ denote the null pointer used in Algorithm T.

taocpmathematicsalgorithmsvolume-3simple
TAOCP 6.3 Exercise 36

We correct both parts, addressing the missing rigor in Algorithm D and completely rebuilding the Patricia argument using a valid global construction.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.2 Exercise 2

For each pair $(j,i)$ with $j<i$, step C4 increases exactly one of `COUNT[j]` or `COUNT[i]`.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.2.4 Exercise 6

We restart the construction in a fully TAOCP-consistent form by defining a single recursive deletion procedure in which every descent step is preceded by an invariant-preserving repair.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.3 Exercise 9

Let $B_{n,h}$ denote the number of AVL (balanced) binary trees with $n$ internal nodes and height exactly $h$, and B_n=\sum_{h\ge 0} B_{n,h}.

taocpmathematicsalgorithmsvolume-3hm-project
TAOCP 6.2.1 Exercise 20

Let $C(N)=\log_b N$ for a constant $b>1$ to be determined.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.2.4 Exercise 2

Let $m=7$.

taocpmathematicsalgorithmsvolume-3simple
TAOCP 6.4 Exercise 5

Let a FORTRAN identifier be a string $K = c_1 c_2 \dots c_n$ with $1 \le n \le 10$, and let the proposed hash function be h(K) = \text{leftmost byte of } K.

taocpmathematicsalgorithmsvolume-3simple
TAOCP 5.2.2 Exercise 2

(a) The permutation $376981452$ has the disjoint cycle decomposition (1\,3\,6\,4\,9\,2\,7)(5\,8).

taocpmathematicsalgorithmsvolume-3
TAOCP 6.2.1 Exercise 13

Shar’s method in this exercise is the standard binary search method on an ordered table.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.4.2 Exercise 16

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

taocpmathematicsalgorithmsvolume-3hm-project
TAOCP 6.3 Exercise 2

Let $K$ be the search argument, and assume it is represented as a sequence of characters ending with the blank symbol used in Algorithm T.

taocpmathematicsalgorithmsvolume-3medium
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.1 Exercise 8

Let H_N^{(\theta)}=\sum_{k=1}^{N} k^{-\theta}, \qquad \theta \neq 1.

taocpmathematicsalgorithmsvolume-3hm-medium
TAOCP 6.1 Exercise 21

Let $G_n$ be the $n$-cube with vertex set $\{0,1\}^n$.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 6.2.1 Exercise 18

The reviewer is correct that the previous solution replaced Program F’s frequency model with an unjustified uniform-visitation assumption.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 6.4 Exercise 7

Let $F = \mathrm{GF}(2^n)$, and let $a \in F$ be an element of order $n$.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.2.1 Exercise 14

Let $N>1$ be arbitrary.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.2 Exercise 12

The flaw in the previous argument is not the linear algebraic part but the missing derivation of the transition rule from the definition of the perfect Fibonacci (perfect polyphase) distributions in (...

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.2.1 Exercise 12

Let $N=12$.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.3.3 Exercise 15

The previous proof failed because it incorrectly treated reachability in a general DAG as if it could be incremented only locally per comparison, and then incorrectly decomposed two dependent costs as...

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.2.2 Exercise 5

Let $b_1 b_2 \dots b_n$ be the inversion table of the permutation $a_1 a_2 \dots a_n$.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.1.4 Exercise 10

Let N(a,b,c) denote the number of permutations of the multiset

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.4.2 Exercise 13

Working

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.1.4 Exercise 6

Let Algorithm S be the full sequence of insertions described in Algorithm I applied successively, terminating with a tableau $P$ and a final added position $(r,s)$ determined at the last insertion ste...

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.3.4 Exercise 6

We work in the model where a _stage_ consists of a set of pairwise disjoint comparisons, and all comparisons in a stage are executed simultaneously.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.2.1 Exercise 3

No.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.3.1 Exercise 2

The root node compares $K_1$ and $K_2$.

taocpmathematicsalgorithmsvolume-3
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 6.2.2 Exercise 19

Let $N$ keys be inserted in random order into a binary search tree generated by Algorithm T.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.2.1 Exercise 14

Let $A_{i,j}$ be defined by Eq.

taocpmathematicsalgorithmsvolume-3math-hard
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 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.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 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.3 Exercise 4

**Corrected Solution to Exercise 5.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.3 Exercise 31

Let $A_n$ be the expected cost of an $M$-ary digital search tree built from $n$ random keys, and let $P(z)$ be its Poisson transform.

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 5.4.2 Exercise 7

Let f_p(z)=z^p - z^{p-1}-\cdots-1.

taocpmathematicsalgorithmsvolume-3hm-medium
TAOCP 6.4 Exercise 45

We restart from the actual stochastic structure of tertiary clustering and keep track of the dependence that was incorrectly removed in the previous solution.

taocpmathematicsalgorithmsvolume-3math-project
TAOCP 5.3.3 Exercise 8

Let the selection algorithm be modified so that the input is partitioned into groups of 5 instead of groups of 7, and the median-of-medians is used as the pivot exactly as in the proof of Theorem L.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.4.9 Exercise 10

Let $A_i(n)$ denote the minimum transmission cost (external path length) among all merge trees with $n$ leaves, under fixed parameters $a$ and $b$ as in Section 5.

taocpmathematicsalgorithmsvolume-3hm-project
TAOCP 5.2.2 Exercise 7

Batcher’s merge-exchange method is not stable.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.4 Exercise 68

Let $S_N = d_1 + d_2 + \cdots + d_N$.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.4 Exercise 54

Start from Eq.

taocpmathematicsalgorithmsvolume-3hm-hard
TAOCP 6.2.1 Exercise 7

The flaw in the previous solution is that it replaces Algorithm U’s interval invariant with a “reachability” heuristic.

taocpmathematicsalgorithmsvolume-3math-medium
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 74

Let $H$ be a matrix whose rows are hash functions $h : \mathcal{K} \to {0,1,\dots,M-1}$, and whose columns correspond to keys.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.4.9 Exercise 22

The previous solution fails because it ignores that block placement is constrained by the _run structure of the merge schedule induced by the Gilbreath principle_, not by the index order of the input...

taocpmathematicsalgorithmsvolume-3medium
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.3.2 Exercise 5

Let $T$ be any comparison decision tree for merging $A_1<\cdots<A_m$ with $B_1<\cdots<B_{n+1}$, and let its height be the number of comparisons in the worst case.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.2.1 Exercise 11

Let \pi = (1,2,5,3,7,4,8,6,9,11,10,12).

taocpmathematicsalgorithmsvolume-3math-simple
TAOCP 6.4 Exercise 4

Let $N = 365$ and let $n$ be the number of people.

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 6.2.3 Exercise 26

A $t$-ary tree is a rooted ordered tree in which each internal node has at most $t$ children.

taocpmathematicsalgorithmsvolume-3project
TAOCP 6.4 Exercise 27

The previous argument failed because it replaced both the definition of $s(n,\alpha,y)$ and Abel’s identity with unverified variants.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.4.1 Exercise 19

We restart from a faithful snowplow model of replacement selection and avoid any per-record attribution.

taocpmathematicsalgorithmsvolume-3hm-medium
TAOCP 6.2.4 Exercise 8

Working

taocpmathematicsalgorithmsvolume-3
TAOCP 5.2.3 Exercise 15

**Corrected Solution for Exercise 5.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.3.3 Exercise 11

Let $t > 2$ and $k > t$ be integers.

taocpmathematicsalgorithmsvolume-3hard
TAOCP 5.2.3 Exercise 8

**Corrected Solution: Exercise 5.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.2.1 Exercise 27

The error in the previous solution is not cosmetic.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 6.2.3 Exercise 14

Algorithms 6.

taocpmathematicsalgorithmsvolume-3simple
TAOCP 6.4 Exercise 26

Let the hash table be initially empty and let linear probing be used for collision resolution.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.4.8 Exercise 4

Let floors $p<q$ satisfy $g_q>p+2$, $u_p>0$, $u_q>0$, and $u_{p+1}=\cdots=u_{q-1}=0$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.4.1 Exercise 24

The errors in the previous solution stem from two issues: (i) failure to verify that the transformation “descending run = apply $x \mapsto 1-x$” preserves the structural hypotheses of Theorem K at the...

taocpmathematicsalgorithmsvolume-3
TAOCP 6.4 Exercise 46

Let the table size be $M$, with $n$ stored keys and load factor $p=n/M$.

taocpmathematicsalgorithmsvolume-3math-project
TAOCP 5.4.3 Exercise 11

The exercise statement is incomplete.

taocpmathematicsalgorithmsvolume-3math-project
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.4.2 Exercise 20

Let $T=6$ and $P=5$.

taocpmathematicsalgorithmsvolume-3math-medium
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 6.2.1 Exercise 9

Let Algorithm B denote the standard binary search of Section 6.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.3 Exercise 15

The flaw in the previous argument is real: the insertion point cannot depend on the unknown divergence index $d$, so any attempt to define it during the initial search is circular.

taocpmathematicsalgorithmsvolume-3hard
TAOCP 6.3 Exercise 32

Let keys be infinite binary sequences generated by independent unbiased bits.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.1.3 Exercise 11

**Exercise 5.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.2.1 Exercise 6

Let $R_1,\dots,R_N$ be the records, and let their final order after two-way insertion be determined as in Table 2, where each new record is inserted either to the left end or the right end of the curr...

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.2 Exercise 5

The changes preserve correctness.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.2.3 Exercise 7

Let $B_h$ denote the number of balanced trees of height $h$, and define $C_h = B_h + B_{h-1}$.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.3.4 Exercise 4

Let $T(6)$ denote the minimum depth of a sorting network on 6 inputs.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.2.4 Exercise 1

The search for $613$ proceeds from the root by repeated comparison with the keys in each visited node, following the rightmost pointer at each step since $613$ exceeds every key encountered in Fig.

taocpmathematicsalgorithmsvolume-3simple
TAOCP 6.3 Exercise 30

We restart from the actual structure of the defining equation (15) and avoid introducing any artificial kernel.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.4 Exercise 9

Let $\theta \in (0,1)$ be irrational, and let the sequence of points ${n\theta}$ be inserted into $[0,1]$ as in Theorem S of Section 6.

taocpmathematicsalgorithmsvolume-3math-hard