brain

tamnd's digital brain — notes, problems, research

43815 notes

TAOCP 2.3.4.2 Exercise 3

Let the vertex set be ${V_1,V_2,V_3}$ and let the arc set consist of e_1: V_1 \to V_2, \qquad e_2: V_1 \to V_3.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.4.2 Exercise 6

False.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.4.2 Exercise 1

Let P=(e_1,e_2,\ldots,e_n) be an oriented walk from $V$ to $V'$.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.4.1 Exercise 13

Suppose first that the graph is connected.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.4.1 Exercise 9

The construction extends naturally to a multigraph, where several edges may join the same pair of vertices and loops are also permitted.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.4.1 Exercise 10

The terminals $T_1,T_2,\ldots,T_n$ correspond naturally to the vertices of a graph, and the wires correspond to edges connecting pairs of vertices.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.4.1 Exercise 11

Let $e=T_{n-1}T_n$ be an edge of minimum cost among all edges incident with $T_n$, so that $c(n-1,n)=\min_{1\le i<n}c(i,n)$.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.4.1 Exercise 8

Let the original flow chart have vertex set $V$ and edge set $E$, and let the reduced chart be obtained by partitioning $V$ into disjoint blocks $V^{(1)},\ldots,V^{(r)}$ and replacing each block by a...

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.4.1 Exercise 5

Let $G'$ be the chosen free subtree and let the independent variables be the values assigned to the non-tree edges $E_2,E_5,\ldots,E_{25}$, as in Eq.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.4.1 Exercise 7

The construction in this exercise depends on the exact adjacency structure of the flow chart in Fig.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.4.1 Exercise 6

Construct an adjacency representation of the graph from the pairs $(a_1,b_1),\ldots,(a_m,b_m)$, interpreting each edge $e_i$ as joining $V_{a_i}$ to $V_{b_i}$.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.4.1 Exercise 4

Let $G'$ be a finite free tree with $n$ vertices and $n-1$ edges, and assume Kirchhoff’s law (1) holds at every vertex with all vertex values equal to $0$, so that at each vertex the sum of $E$’s ente...

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.4.1 Exercise 2

Let $(V_0,V_1,\ldots,V_n)$ be a walk from $V$ to $V'$.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.4.1 Exercise 3

The fundamental path from Start to Stop is the path in the free subtree determined by the cycle $C_0$ with $e_0$ omitted: e_1+e_3+e_4+e_6+e_7+e_9+e_{10}+e_{11}+e_{12}+e_{14}.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.3 Exercise 17

[Section 2.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.3 Exercise 19

We are asked to reason about **descendant number sequences** in preorder.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 2.3.3 Exercise 18

Let the forest be given in preorder sequential representation: - `INFO1[j]` contains the node information.

taocpmathematicsalgorithmsvolume-1hard
TAOCP 2.3.4.1 Exercise 1

In Fig.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.3 Exercise 15

[Section 2.

taocpmathematicsalgorithmsvolume-1project
TAOCP 2.3.3 Exercise 14

[Section 2.

taocpmathematicsalgorithmsvolume-1project
TAOCP 2.3.3 Exercise 16

Let the given forest be represented in postorder with degrees as in representation `(9)`.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.3 Exercise 11

The ordinary Algorithm `E` maintains a forest of equivalence classes.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.3 Exercise 13

Step `A8` is reached only when Algorithm `A` has determined that the two terms currently under consideration correspond to the same power of the same variable, so that their coefficients must be combi...

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 2.3.3 Exercise 12

[Section 2.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.3 Exercise 10

Associate with each root $r$ an integer $\mathrm{SIZE}(r)$ equal to the number of nodes in its tree.

taocpmathematicsalgorithmsvolume-1hard
TAOCP 2.3.3 Exercise 8

We are asked to design an algorithm that answers the query "`Is $j \equiv k$?

taocpmathematicsalgorithmsvolume-1simple
TAOCP 2.3.3 Exercise 7

The relation $9 \equiv 3$ serves only to place the element $9$ into the equivalence class containing $3$.

taocpmathematicsalgorithmsvolume-1simple
TAOCP 2.3.3 Exercise 9

We are asked to give a table analogous to `(15)` and a diagram analogous to `(16)` showing the trees present after Algorithm `E` has processed all equivalences in `(11)`.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.3 Exercise 5

A triply linked tree contains, for each node $x$, three pointers: $PARENT(x)$ to the parent of $x$, $LCHILD(x)$ to the leftmost child of $x$, and $RLINK(x)$ to the next sibling of $x$.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.3 Exercise 6

Let the nodes be linked initially by the arbitrary linear list \text{FIRST} \to x_1 \to x_2 \to \cdots \to x_n \to \Lambda, through their present `RLINK` fields.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.3 Exercise 4

Let the original forest contain $n$ nodes, of which $m$ are terminal.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.3 Exercise 3

Algorithm `2.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.2 Exercise 21

Yes.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.3 Exercise 1

We are asked: > If we had only `LTAG`, `INFO`, and `RTAG` fields (not `LLINK`) in a level-order sequential representation like (8), would it be possible to reconstruct the `LLINK`s?

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.3 Exercise 2

We are asked to design an algorithm analogous to Algorithm `F` for the _preorder with degrees_ representation of a forest, traversing from **right to left**.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.2 Exercise 22

[Section 2.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 2.3.2 Exercise 18

Let the nodes be numbered $1,2,\ldots,n$ in their location order.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.2 Exercise 19

For every pair of subformulas $(A,B)$ occurring in $X$ and $Y$, define a Boolean value T(A,B).

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 2.3.2 Exercise 17

Represent every expression by a tree whose internal nodes are only the operators `$+$`, `$\times$`, and `$\ln$`.

taocpmathematicsalgorithmsvolume-1math-project
TAOCP 2.3.2 Exercise 20

Let $F$ be a forest and let $u, v$ be nodes in $F$.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.2 Exercise 14

Exercise 14 asks for the running time of the `COPY` subroutine of Exercise 13.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.2 Exercise 15

The routine `DIV` computes the derivative of a formula of the form $u / v$ with respect to the variable $x$, according to rule `(18)`: D(u/v) = D(u)/v - (u \times D(v))/(v \uparrow 2).

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.2 Exercise 13

[Section 2.

taocpmathematicsalgorithmsvolume-1hard
TAOCP 2.3.2 Exercise 16

Exercise `12` specifies `DIFF[8]` for exponentiation, corresponding to rule `(19)`: D(u \uparrow v) = D(u) \times \bigl(v \times (u \uparrow (v - 1))\bigr) + \bigl((\ln u) \times D(v)\bigr)\times(u \u...

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.2 Exercise 11

We are asked to draw trees analogous to those in `(7)` corresponding to the formula y = e^{-x^2}.

taocpmathematicsalgorithmsvolume-1simple
TAOCP 2.3.2 Exercise 12

[Section 2.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.2 Exercise 10

Let $F$ and $F'$ be forests whose nodes in preorder are $u_1, u_2, \dots, u_n$ and $u'_1, u'_2, \dots, u'_{n'}$, respectively.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.2 Exercise 8

Let us reformulate the ordering of Exercise `2.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.2 Exercise 6

Let $T$ be a nonempty binary tree in which every node has either $0$ or $2$ children.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.2 Exercise 9

Let $F$ be a forest containing $t$ trees.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.2 Exercise 7

Let the partial order on the nodes of a forest be defined by u < v whenever $v$ is a descendant of $u$.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.2 Exercise 3

Let the Dewey decimal notation of a node be d_1.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.2 Exercise 5

[Section 2.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.2 Exercise 4

We are asked to determine whether the statement > "The terminal nodes of a tree occur in the same relative position in preorder and postorder.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 36

Let $(S, \prec)$ be a well-ordered set.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.1 Exercise 37

Let a binary tree have $n$ nodes.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.2 Exercise 1

Let $B$ be a binary tree.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.2 Exercise 2

Let a forest $F = (T_1, T_2, \dots, T_n)$ be given, with nodes numbered in Dewey decimal notation as in Section 2.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 34

Let the right-threaded binary trees use the conventions of the section: - `LLINK(P)` is either a left child or `\Lambda`.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 33

Let `X` be the new node to insert, and `T` be a pointer to the root of the tree.

taocpmathematicsalgorithmsvolume-1hard
TAOCP 2.3.1 Exercise 35

The fundamental concepts of traversal extend immediately.

taocpmathematicsalgorithmsvolume-1project
TAOCP 2.3.1 Exercise 30

Let `T` be an unthreaded binary tree, represented in the standard form of (2), and let `P` be a pointer to a node of `T`.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 32

Exercise 31 refers to Algorithm `I` for insertion into a right-threaded binary tree.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 29

Algorithm `C` is intended to construct a new binary tree whose nodes contain the same information as the original tree and whose link structure is identical, regardless of whether a field represents a...

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.1 Exercise 31

Let `T` be the pointer to the right-threaded binary tree, and let `AVAIL` be the head of the list of available nodes.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 28

[Section 2.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3.1 Exercise 26

Let $D(T)$ denote the double-order sequence of a binary tree $T$, as defined in exercise 18.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.1 Exercise 27

[Section 2.

taocpmathematicsalgorithmsvolume-1hard
TAOCP 2.3.1 Exercise 25

We first interpret the definition of $\preceq$ as a recursive lexicographic comparison of trees: the empty tree precedes every tree; among nonempty trees, the roots are compared first; if the roots ag...

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.1 Exercise 23

A _right-threaded_ binary tree contains ordinary left links and either ordinary right links or right threads.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 22

We are asked to write a MIX program that implements the algorithm of Exercise 21, which traverses an unthreaded binary tree in inorder _without using any auxiliary stack_, modifying the `LLINK` and `R...

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 24

No.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.1 Exercise 21

We employ the _threading during traversal_ method, also known as the _Morris traversal_, which creates temporary links to predecessors during the traversal to avoid using a stack.

taocpmathematicsalgorithmsvolume-1hard
TAOCP 2.3.1 Exercise 19

The preorder successor is characterized as follows.

taocpmathematicsalgorithmsvolume-1hard
TAOCP 2.3.1 Exercise 20

Algorithm `T` uses an auxiliary stack `A` in consecutive memory locations.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 15

Let a node $P$ of a threaded binary tree be given.

taocpmathematicsalgorithmsvolume-1simple
TAOCP 2.3.1 Exercise 16

Let `P` point to a node of a binary tree, and consider `Q = P*`, the successor of `NODE(P)` in preorder.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 17

We are asked to give an algorithm analogous to Algorithm `S` that determines the preorder successor `P*` of a node `P` in a threaded binary tree with a list head as in `(8), (9), (10)`.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 18

The double-order traversal visits each node twice.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 13

A postorder traversal must process a node only after both of its subtrees have been traversed.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 12

We aim to construct an algorithm analogous to Algorithm `T` that traverses a binary tree in _preorder_, visiting each node exactly once, and then prove its correctness by induction on the number of no...

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 11

Let $B_n$ denote the number of binary trees with $n$ nodes.

taocpmathematicsalgorithmsvolume-1hm-project
TAOCP 2.3.1 Exercise 14

In the representation (2), each node contains exactly two links, `LLINK` and `RLINK`.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 10

The stack grows only in step `T3`, where the current value of `P` is pushed onto `A` and then `P` is replaced by `LLINK(P)`.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 9

Let a binary tree with `n` nodes be traversed using Algorithm `T`.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.1 Exercise 8

Let the nodes of a binary tree be distinct.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 7

Let the preorder of the binary tree be $u_1 u_2 \dots u_n$ and the inorder be $v_1 v_2 \dots v_n$.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 6

Let a binary tree have $n$ nodes, with preorder sequence u_1 u_2 \dots u_n and inorder sequence

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 2.3.1 Exercise 5

Let the representation of a node be the binary string $\alpha$, where the root is represented by `"1"`, the left child of $\alpha$ is $\alpha0$, and the right child is $\alpha1$.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 2

Let `T` denote the root of the binary tree in the figure.

taocpmathematicsalgorithmsvolume-1simple
TAOCP 2.3.1 Exercise 1

[Section 2.

taocpmathematicsalgorithmsvolume-1simple
TAOCP 2.3.1 Exercise 4

Let us define the new traversal order recursively, as in the exercise: 1.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3.1 Exercise 3

The statement claims that "The terminal nodes of a binary tree occur in the same relative position in preorder, inorder, and postorder.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 2.3 Exercise 22

[Section 2.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3 Exercise 20

[Section 2.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3 Exercise 21

[Section 2.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3 Exercise 17

[Section 2.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3 Exercise 19

[Section 2.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3 Exercise 18

[Section 2.

taocpmathematicsalgorithmsvolume-1
TAOCP 2.3 Exercise 15

[Section 2.

taocpmathematicsalgorithmsvolume-1