brain

tamnd's digital brain — notes, problems, research

41265 notes

TAOCP 6.2.1 Exercise 20

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

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

Let condition (31) be the 2-descending condition for binary search trees: for every node $P$, every node $Q$ in the subtree rooted at $\mathrm{LLINK}(P)$ satisfies $\mathrm{KEY}(Q) < \mathrm{KEY}(P)$,...

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.4 Exercise 1

The previous solution fails because it replaces MIX instruction semantics with an unsupported linear model and ignores control flow.

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

The flaw in the previous solution is the attempt to characterize the event using the original suffix $R_2,\dots,R_n$ without tracking how a bubble sort pass changes the array after the first compariso...

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

No.

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

No.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.1.3 Exercise 7

Let $X_n$ denote the number of descents in a random permutation of ${1,2,\dots,n}$.

taocpmathematicsalgorithmsvolume-3hm-project
TAOCP 5.3.2 Exercise 17

We now reconstruct equation (21) from the standard context of Section 5.

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

The issue is not merely tree degeneracy at $P=2$, but the fact that Algorithm R implicitly assumes the existence of at least one comparison.

taocpmathematicsalgorithmsvolume-3simple
TAOCP 5.2.3 Exercise 14

Exercise 16 describes the standard heap insertion operation: append the new key at the end of the heap and repeatedly interchange it with its parent until the heap property is restored.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.3 Exercise 40

The failure of the original solution is the artificial reduction to a fixed window $t_0,\dots,t_{2N-1}$.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.2 Exercise 29

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

taocpmathematicsalgorithmsvolume-3project
TAOCP 6.2.2 Exercise 23

We restart from the correct objective formulation and avoid any local “node-only” rotation arguments.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.3.1 Exercise 3

We must construct an **extended ternary decision tree for sorting four elements drawn from $\{-1,0,+1\}$** using comparison nodes with outcomes $<,=,>$, and determine a tree with **minimum average num...

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

Algorithm F forecasts the next input operation by examining the last records currently present in the active buffers.

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

We restart from the cascade structure in Algorithm C and derive equation (14) in a way that correctly matches the backward extension construction and applies Lagrange inversion in its valid form.

taocpmathematicsalgorithmsvolume-3hm-hard
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 5.2.3 Exercise 15

**Corrected Solution for Exercise 5.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.8 Exercise 1

Let the original order-$P$ bubble sort be defined as in Section 5.

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

We now give a fully corrected TAOCP-style solution, aligning directly with recurrence (4) for $A_N$ and definition (5) for $C_N$, and avoiding heuristic arguments.

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

After Step 3 the current front keys of the four runs are $503,\ 170,\ 426,\ 612$ after the replacement of $154$ by $426$.

taocpmathematicsalgorithmsvolume-3simple
TAOCP 5.3.2 Exercise 7

The original argument fails because it never establishes a real comparison between the two quantities $M(k+m,n)$ and $M(k,n)+M(m,n)$.

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

Let $n$ be the total number of distinct elements.

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

The reviewer is correct on all four failure points.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.3.2 Exercise 20

Fix $m<n$.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.2 Exercise 13

Working

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.1 Exercise 15

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

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.3 Exercise 16

Patricia trees represent a set of strings by a compressed trie in which each branching decision is determined by inspecting selected character positions, and in which nodes are arranged so that every...

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.4.2 Exercise 15

The statement concerns three families of quantities $X_n(m)$, $Y_n(m)$, $S_n(m)$, together with a primed variant $X'_{n-1}(m)$.

taocpmathematicsalgorithmsvolume-3math-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 6.1 Exercise 6

The previous solution fails because it violates MIX syntax (memory increment and malformed immediate comparisons) and because it does not specify a legitimate instruction-level control structure tied...

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.2.3 Exercise 11

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

taocpmathematicsalgorithmsvolume-3simple
TAOCP 6.2.2 Exercise 12

Let $Q$ be the node selected for deletion, chosen uniformly from the $N$ nodes of a binary search tree formed by random insertion of $N$ keys.

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

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

taocpmathematicsalgorithmsvolume-3research
TAOCP 5.1.2 Exercise 11

**Exercise 5.

taocpmathematicsalgorithmsvolume-3
TAOCP 5.4.2 Exercise 9

Let $K_m$ denote $K^{(p)}$, the number of sequences of length $m$ consisting of $0$’s and $1$’s that contain no $p$ consecutive $1$’s.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.4.9 Exercise 11

Working

taocpmathematicsalgorithmsvolume-3math-hard
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 5.4.6 Exercise 12

Six tapes are partitioned into three logical pairs.

taocpmathematicsalgorithmsvolume-3project
TAOCP 6.4 Exercise 72

Let $H$ be a matrix with $R$ rows and one column for every possible key $K$.

taocpmathematicsalgorithmsvolume-3math-hard
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 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 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 6.2.2 Exercise 39

Let $w_1,\dots,w_n$ be nonnegative with $w_1+\cdots+w_n=1$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 5.2.3 Exercise 7

After 14 outputs, all but two elements have been replaced by $-\infty$ in the tournament structure of Fig.

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

The previous argument fails because it replaces Floyd’s comparison accounting with informal “reuse” claims and an invalid decomposition into independent subproblems.

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

The previous solution correctly implemented a left-to-right maximum search, but it never established the _inter-iteration structure_ that makes the modification useful.

taocpmathematicsalgorithmsvolume-3
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 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
TAOCP 5.2.3 Exercise 8

**Corrected Solution: Exercise 5.

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

Let the two sorted sequences have lengths $m$ and $n$.

taocpmathematicsalgorithmsvolume-3math-project
TAOCP 5.2.3 Exercise 3

The previous solution failed because it used unsupported structural claims about cycles and an undefined “charging” argument.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.4 Exercise 22

We work in the setting of Algorithm C, where each key $x$ is inserted into a singly linked chain for bucket $h(x)$ by _inserting at the head_.

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.2.4 Exercise 8

The error in the previous solution occurs at exactly one decisive point: the computation of m_k=\left\lfloor \frac{r_k}{2}\right\rfloor from the binary expansion of $N$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.1 Exercise 11

The reviewer is correct: the proposed solution does not address the problem at all.

taocpmathematicsalgorithmsvolume-3math-hard
TAOCP 5.1.3 Exercise 4

**Corrected Solution to Exercise 5.

taocpmathematicsalgorithmsvolume-3
TAOCP 6.2.2 Exercise 45

Let the sequence maintained by the Garsia–Wachs algorithm be $L = (l_1, l_2, \dots, l_m)$ in symmetric order.

taocpmathematicsalgorithmsvolume-3hard
TAOCP 5.4.2 Exercise 31

Let $K_a(n)$ denote the number of ordered (plane) rooted trees with $n$ nodes in which every leaf is at distance exactly $a$ from the root.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.2.3 Exercise 12

Let $T_7$ denote a balanced binary tree with $7$ internal nodes.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.2.1 Exercise 23

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

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.4 Exercise 49

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

taocpmathematicsalgorithmsvolume-3hm-medium
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.2.2 Exercise 47

A _t-ary search tree_ is taken in the standard sense of Section 6.

taocpmathematicsalgorithmsvolume-3math-project
TAOCP 5.4.9 Exercise 12

Let $T$ be a rooted tree with $n>0$ leaves, and let the degree path length $(6)$ be defined as in Section 5.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 5.1.4 Exercise 9

Let M= \begin{pmatrix} q_1&q_2&\cdots&q_n\\ p_1&p_2&\cdots&p_n

taocpmathematicsalgorithmsvolume-3math-project
TAOCP 5.4.6 Exercise 1

Let $L = 23{,}000{,}000$.

taocpmathematicsalgorithmsvolume-3medium
TAOCP 6.1 Exercise 21

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

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

Let $b_j$ be the number of external nodes at level $j$.

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.1 Exercise 2

Let $P$ be a pointer to a record, with $FIRST$ pointing to the first record and the last record linked to the sentinel $A$.

taocpmathematicsalgorithmsvolume-3simple
TAOCP 5.3.2 Exercise 12

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

taocpmathematicsalgorithmsvolume-3math-medium
TAOCP 6.2.1 Exercise 27

The error in the previous solution is not cosmetic.

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.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 41

Let $M$ be the table size and $N$ the number of occupied cells under simple uniform hashing, so that all $\binom{M}{N}$ occupied sets are equally likely.

taocpmathematicsalgorithmsvolume-3math-project
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