brain

tamnd's digital brain — notes, problems, research

41641 notes

TAOCP 5.4.9 Exercise 18

Let $S$ be the number of elevator stops required by a fixed scheduling method applied to a uniformly random permutation of the $bn$ people among the $bn$ desks.

taocpmathematicsalgorithmsvolume-3hm-hard
TAOCP 6.2.3 Exercise 5

Let the keys be $K_y, K_0, K_1, \dots, K_n$ with $K_y < K_0 < K_1 < \cdots < K_n.$ At every stage, Algorithm A inserts the new key as a leaf in the rightmost position of the current tree, since each n...

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.4.6 Exercise 13

The previous solution fails because it attempts to repair the situation by adding an external phase.

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

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

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.4 Exercise 4

We restart from the standard Bayer–McCreight B-tree model and make explicit the structural object being modified.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.7 Exercise 2

The earlier solution fails because it imports a Fibonacci _tape-capacity invariant_ from polyphase merging that does not belong to radix distribution.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 6.2.2 Exercise 14

The original argument fails because it assumes a uniform “shift” of depths along the entire search path from $x$ to the chosen replacement node.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.3.2 Exercise 11

The sequence is defined explicitly by g_0 = \lfloor 4\cdot 2^0 \rfloor,\qquad g_{k+1} = \lfloor 2^{g_k} \rfloor.

taocpmathematicsalgorithmsvolume-3math-project
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.1.4 Exercise 8

**Exercise 5.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.1.3 Exercise 8

**Exercise 5.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.4.6 Exercise 9

The previous solution fails because it never uses the actual structure of Chart A, and therefore never computes the polyphase schedule or I/O count for $T=6$.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.2.3 Exercise 11

Let elements arrive in a sequence at times $t = 1,2,\ldots$.

taocpmathematicsalgorithmsvolume-3simple
TAOCP 5.4.1 Exercise 8

Algorithm R relies on a distinguished key value $oo$ such that for every actual key $K$, the relation $K < oo$ holds in the ordering used by the selection tree.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.3 Exercise 15

Let $T$ be the binary search tree representing an ordered linear list, with fields $\text{KEY}(P)$ and $\text{RANK}(P)$ in each node $P$.

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

Let A(x_1,\ldots,x_n) denote the alternating polynomial introduced in this section.

taocpmathematicsalgorithmsvolume-3hm-medium
TAOCP 5.5 Exercise 3

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

taocpmathematicsalgorithmsvolume-3research
TAOCP 6.2.1 Exercise 27

The error in the previous solution is not cosmetic.

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

We construct a correct solution directly from the complete binary tree representation, without relying on any claim about equivalence with ordinary binary search.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.3 Exercise 8

Let $T=6$ in the notation of the section, and write X_n = (A_n, B_n, C_n, D_n, E_n)^T .

taocpmathematicsalgorithmsvolume-3hm-medium
TAOCP 5.4.9 Exercise 13

Let $T$ range over admissible merge patterns for $n$ runs, where each internal node has arity at most $8$, and cost is the weighted external path length C(T)=\sum_{i=1}^n w_i d_i.

taocpmathematicsalgorithmsvolume-3math-medium
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.4.6 Exercise 11

The core failure in the previous solution is not the lack of prose, but the absence of any actual instantiation of Chart A and Table 1 into computable expressions.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.1 Exercise 12

Let $N=12$.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.2 Exercise 30

We prove the equivalent form of the quadrangle inequality: c(i,j)-c(i,j-1)\;\ge\;c(i+1,j)-c(i+1,j-1), \qquad j>i+1, which is equivalent to

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.4.7 Exercise 7

A multireel file consists of a finite sequence of reels, each reel being a sequential medium on which records are read and written in forward order, with a forced change of reel when an end is reached...

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.3 Exercise 3

Let each key $x$ in the set of 31 words have frequency $f(x)$ as given by Fig.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.9 Exercise 16

The previous solution fails because it never uses the actual data of configurations (28) and (29).

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.3.2 Exercise 2

Let $m=1$.

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

The odd-even merge network is composed of two independent recursive merge networks, one acting on the odd subsequences and one acting on the even subsequences, followed by a single layer of comparison...

taocpmathematicsalgorithmsvolume-3
TAOCP 6.4 Exercise 66

Assume an open addressing scheme using Algorithm L or Algorithm D.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.2.4 Exercise 7

A correct analysis must stay inside the structural model of Program L (natural two-way merge on runs), interpret the quantities exactly as defined in Knuth’s framework, and then specialize to the conc...

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.4.2 Exercise 18

Let $T > 3$ be fixed and set $P = T - 1$.

taocpmathematicsalgorithmsvolume-3hard
TAOCP 5.4.2 Exercise 1

The reviewer is correct on all four failure points.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.2.3 Exercise 1

For a fixed value of $j$, step S2 selects the maximum of the keys $K_1,\ldots,K_j$.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.4 Exercise 56

Let $n = Mb$.

taocpmathematicsalgorithmsvolume-3hm-project
TAOCP 6.3 Exercise 8

Algorithm D maintains two variables during a descent in a digital search tree: $K$, the working copy of the search argument whose leading digit (or bit) determines the branching, and $K'$, a preserved...

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.3.3 Exercise 4

Let $A$ be an optimal comparison-based algorithm that finds the third largest element, and let its worst-case number of comparisons be $V_3(n)$.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.3 Exercise 20

We correct the analysis by keeping the Poissonized occupancy framework but fixing the asymptotic accuracy statements and making the sequential-search contribution explicit.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.2.4 Exercise 2

Let $X$ be the number of times step M2 is executed when merging $x_1,\dots,x_m$ with $y_1,\dots,y_n$.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.4.1 Exercise 25

The previous solution failed because it tried to _postulate_ a kernel and then retrofit a “memoryless explanation” instead of deriving the joint law from the actual state evolution at the instants whe...

taocpmathematicsalgorithmsvolume-3hm-project
TAOCP 6.2.1 Exercise 21

Let the keys be K_1<K_2<\cdots<K_{10}, and let the unsuccessful-search intervals (gaps) be

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.3 Exercise 24

Let $W(x)$ denote the number of internal nodes in the subtree rooted at $x$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.4.2 Exercise 20

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

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.3.2 Exercise 6

The proof of Theorem K is carried out by verifying that a proposed closed form agrees with the values of the adversary functions $_M(m,n)$ defined by the recurrence inequalities coming from Strategies...

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 6.4 Exercise 8

We restart from the correct structure and avoid any use of invalid fractional-part algebra.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.4.6 Exercise 12

Six tapes are partitioned into three logical pairs.

taocpmathematicsalgorithmsvolume-3project
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.5 Exercise 8

Let the radix be $M$ and let keys be written as $(a_1,a_2,\dots,a_p)$ with digits $0 \le a_i < M$.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.2.3 Exercise 8

**Corrected Solution: Exercise 5.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.4 Exercise 54

Start from Eq.

taocpmathematicsalgorithmsvolume-3hm-hard
TAOCP 6.4 Exercise 4

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

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 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 6.2.2 Exercise 48

Let $T_n$ denote the set of binary search trees on $n$ distinct keys, and consider the Markov process in which at each step an insertion of a random key and a deletion of a uniformly chosen node are p...

taocpmathematicsalgorithmsvolume-3
TAOCP 6.4 Exercise 43

Let $N$ denote the number of items stored.

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 6.4 Exercise 62

The previous solution incorrectly assumed that the cost functional decomposes as C_y = \frac{1}{M}\sum_K C(K), with each $C(K)$ depending only on the increment sequence assigned to $K$.

taocpmathematicsalgorithmsvolume-3math-research
TAOCP 6.2.4 Exercise 2

Let $m=7$.

taocpmathematicsalgorithmsvolume-3simple
TAOCP 5.4.2 Exercise 27

The reviewer’s diagnosis is correct: the previous proof implicitly replaced each tape by a globally sorted sequence, which is false.

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

We construct a single, explicit decision tree of comparisons whose worst-case depth is at most 7.

taocpmathematicsalgorithmsvolume-3hard
TAOCP 6.4 Exercise 10

Let \[ S_j=\{\,\{n\theta+a_j\}:0\le n<N_j\,\},\qquad 1\le j\le d, \] and let \(S=\bigcup_{j=1}^d S_j\).

taocpmathematicsalgorithmsvolume-3math-project
TAOCP 5.2.3 Exercise 2

For the input $N,N-1,\ldots,2,1$, the sequence $K_1, K_2, \ldots, K_j$ is strictly decreasing for every $j \ge 2$.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.2.1 Exercise 22

We reconstruct the argument in a fully standard comparison-model framework and remove all heuristic claims.

taocpmathematicsalgorithmsvolume-3math-project
TAOCP 6.2.2 Exercise 18

Start by separating what must be proved from what was previously assumed without justification.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.4.2 Exercise 17

The previous argument failed because it replaced the polyphase state space with an incorrect arithmetic model.

taocpmathematicsalgorithmsvolume-3hard
TAOCP 6.3 Exercise 29

The previous argument failed because it replaced the actual recursive structure of a digital search tree by an unjustified occupancy limit.

taocpmathematicsalgorithmsvolume-3hm-project
TAOCP 6.2.2 Exercise 49

Let $T_n$ be a binary search tree formed by inserting $n$ distinct keys in random order, each of the $n!$ permutations equally likely, using Algorithm T of Section 6.

taocpmathematicsalgorithmsvolume-3hm-project
TAOCP 5.4.3 Exercise 6

Let v_n = (a_n, b_n, c_n, d_n, e_n) denote the six-tape cascade numbers at level $n$, with initial condition

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.2.3 Exercise 1

In Case 2 the symmetric order of the keys is determined by the in-order sequence of the subtrees: all keys in the left subtree of $A$ precede $\text{KEY}(A)$, all keys in the left subtree of $B$ that...

taocpmathematicsalgorithmsvolume-3simple
TAOCP 6.4 Exercise 19

The previous solution failed in two fundamental ways: it did not perform an empirical investigation and it misinterpreted the constraint $1 < h_2(K) < r$ for small $r$.

taocpmathematicsalgorithmsvolume-3project
TAOCP 6.2.3 Exercise 33

Let $T$ be an AVL tree in the sense of Section 6.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.2.5 Exercise 3

At the start, Algorithm H sets $i \leftarrow 0$ and then sets $P \leftarrow \mathrm{TOP}[0]$.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.4.3 Exercise 4

The previous solution fails because it never uses the actual cascade operator.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.3 Exercise 27

Let $C_N$ denote the quantity defined in equation (14) of Section 6.

taocpmathematicsalgorithmsvolume-3hm-hard
TAOCP 5.4.1 Exercise 28

The key difficulty is not comparison but **storage lifetime**: a variable-length record must remain accessible through its descriptor for as long as it may still reside in the selection tree.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.3.1 Exercise 7

Let the computation be represented by a binary comparison tree.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.2.1 Exercise 15

Let $T_k$ denote the Fibonacci tree of order $k$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.1 Exercise 8

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

taocpmathematicsalgorithmsvolume-3hm-medium
TAOCP 5.4.1 Exercise 2

Figure 63 is a loser tree in which each internal node stores the loser of the comparison, and the root contains the current champion.

taocpmathematicsalgorithmsvolume-3simple
TAOCP 6.2.1 Exercise 30

The previous solution fails because it leaves the comparison model (all information must be in the relative order of the $N$ keys) and because it never constructs a single coherent global ordering tha...

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

Working

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 6.4 Exercise 67

Linear probing with a full table and distinct home addresses is not governed by “cyclic inversion geometry” in the way the previous solution assumed.

taocpmathematicsalgorithmsvolume-3math-project
TAOCP 6.1 Exercise 5

We restart the analysis from the actual structure of the comparison, without introducing abstract per-iteration cost parameters.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.9 Exercise 1

Let $f(\theta)$ denote the optimal single–arm latency function for a request starting at position $\theta$, with \int_0^1 f(\theta)\,d\theta = 4(1-x^2).

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.2.4 Exercise 1

**Corrected Solution to Exercise 5.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.3 Exercise 11

Algorithm 6.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.1.2 Exercise 10

**Solution to Exercise 5.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.4.5 Exercise 1

Let the tapes be $0,1,\dots,P$, where tape $q$ is the designated output tape and the remaining $P$ tapes are work tapes.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.1 Exercise 3

We restart the analysis from the instruction-level behavior of the MIX program.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.4 Exercise 58

Uniform probing, in the sense of Theorem U, corresponds to generating a probe sequence by selecting a permutation of the table addresses ${0,1,2,3,4}$ uniformly from the set of all $5!$ permutations.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.4 Exercise 11

The proposed interchange is not valid in general, because it violates a dependency in the control flow of Program C.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.4 Exercise 44

The previous solution failed because it replaced the actual dependent probing process by an unjustified permutation model.

taocpmathematicsalgorithmsvolume-3math-project
TAOCP 5.2.1 Exercise 2

Let step S4 in Algorithm S be the comparison step that determines whether the current key $K$ should be inserted before $K_i$ or whether $K_i$ should be moved right.

taocpmathematicsalgorithmsvolume-3