brain

tamnd's digital brain — notes, problems, research

43815 notes

CF 104377E - 传感器对齐

We are given two ordered sequences of integers, both of the same length. Each sequence comes from a sensor reading over time, so the index order is fixed and meaningful.

codeforcescompetitive-programming
CF 104377D - 随机数生成器

We are given an array and a random process that repeatedly samples indices uniformly from a chosen segment of this array. After taking k independent samples, we look at the smallest and largest sampled indices and return the sum of the array over that interval.

codeforcescompetitive-programming
CF 104377A - 计算异或和

We are asked to look at all ordered arrays of length $m$ consisting of non-negative integers whose total sum is fixed to $n$. Every such array contributes a value equal to the bitwise XOR of all its elements, and we need the sum of these XOR values over all valid arrays.

codeforcescompetitive-programming
CF 104377C - 二维数组变换

We are given an n by n matrix and a sequence of operations. Each operation selects a square submatrix using its top-left and bottom-right coordinates, then applies one geometric transformation to that submatrix.

codeforcescompetitive-programming
CF 104377B - 最大价值

We are given an undirected graph where each edge carries a weight that behaves like a threshold. You start at node S holding a value k, and want to reach node T.

codeforcescompetitive-programming
TAOCP 7.1.4 Exercise 163

A read-once Boolean function $f(x_1,\ldots,x_n)$ is represented by a formula tree in which each variable occurs exactly once.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 162

Let $X = (x_{ij})$ be a $6 \times 6$ matrix with entries in ${0,1}$.

taocpmathematicsalgorithmsvolume-4hard
CF 104380R - Deque 2 (Hard Version)

We are given a sequence of numbers and we build a deque by processing them in order. For each element, we decide independently whether it is inserted at the front or at the back.

codeforcescompetitive-programming
CF 104380Q - Deque 2 (Easy Version)

We are repeatedly building a sequence of length n by processing the array from left to right. At each step, the current element is inserted either at the front or at the back of an initially empty deque.

codeforcescompetitive-programming
CF 104380P - Dungeon

The dungeon is a straight line, and the knight walks from position 0 to position D without ever turning back. Along this path there are two kinds of encounters: monsters and shops, each placed at fixed positions.

codeforcescompetitive-programming
CF 104380O - Rabbit Jump

We start at the origin in a grid and want to reach a target coordinate $(x, y)$. From any current position, the rabbit has three possible moves: it can move one step right for cost $A$, one step up for cost $B$, or it can scale both coordinates by a factor of two for cost $C$.

codeforcescompetitive-programming
CF 104380N - Robot

We are given a grid representing a maze where some cells are blocked and others are free. A robot starts in the top-left cell and must execute a sequence of moves of fixed length.

codeforcescompetitive-programming
CF 104380M - Tower

Each tower in this problem acts like a light source placed on a number line. A tower at position $ai$ emits a brightness that starts at $pi$ at its own location and then decreases linearly as you move away from it.

codeforcescompetitive-programming
CF 104380L - Equation

We are given a consecutive list of integers starting from 0 up to n. Between every pair of adjacent numbers, we are allowed to insert either a plus or a minus sign, effectively deciding whether each number contributes positively or negatively to a running sum.

codeforcescompetitive-programming
CF 104380K - glimmerypond

We are given a binary grid that represents a pond, where each cell is either water or empty ground. On top of this grid, we consider every possible square region of fixed size $k times k$.

codeforcescompetitive-programming
CF 104380J - No 7

We are given a single positive integer x, and we need to move strictly downward to find the closest smaller integer that avoids a specific digit constraint: none of its decimal digits may be 7.

codeforcescompetitive-programming
CF 104380H - 01 (Hard Version)

We are given a binary string that evolves over time. Two kinds of operations happen: flipping a single character, and answering a query on a substring.

codeforcescompetitive-programming
CF 104380I - Bad Grades

We are given a sequence of exam grades for a student, each grade being an integer between 0 and 100. The task is to produce a cleaned version of this sequence where every grade below 60 is removed, while keeping the relative order of the remaining grades exactly the same as in…

codeforcescompetitive-programming
CF 104380G - Social Network

We are given a set of people labeled from 1 to $n$, but $n$ can be extremely large, so we cannot afford to explicitly build any structure over all individuals.

codeforcescompetitive-programming
CF 104380B - Mine Sweeper

We are given a rectangular grid where every cell contains a number describing how many mines are present in a specific neighborhood around that cell.

codeforcescompetitive-programming
TAOCP 7.1.4 Exercise 161

The earlier solution fails at the point where it replaces the actual definition of $L$ from Exercise 160 with an assumed linear involution structure.

taocpmathematicsalgorithmsvolume-4hard
CF 104380E - Weird Knight

We are given a generalized knight piece that moves on an infinite integer grid. From any cell $(x,y)$, it can jump to eight symmetric positions obtained by permuting and flipping the vectors $(p,q)$ and $(q,p)$ with independent sign changes.

codeforcescompetitive-programming
TAOCP 7.1.4 Exercise 160

Let $N(i,j)$ denote the Moore neighborhood of $(i,j)$, i.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 16

Let the given BDD represent a Boolean function $f(x_1,\dots,x_n)$ in ordered and reduced form as defined in Section 7.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 159

Let $p=n-m$ and write $k_1=\lfloor p/3\rfloor$, $k_2=\lceil 2p/3\rceil$.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 158

Let $p=n-m$ and write $k_1=\lfloor p/3\rfloor$, $k_2=\lceil 2p/3\rceil$.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 157

The key failure in the previous argument is the unproven monotonicity claim: it is not true in general that swapping an adjacent data–selector inversion preserves or improves ROBDD size.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 156

Algorithm J (sifting) for dynamic variable reordering in reduced ordered BDDs operates by selecting a variable and moving it through the current ordering by adjacent swaps, evaluating the cost functio...

taocpmathematicsalgorithmsvolume-4hard
TAOCP 7.1.4 Exercise 155

We restate the problem in the language of TAOCP BDD equivalence classes.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 154

The mistake in the previous solution is the assumption that the movement of each state is determined by the induced permutation between (104) and (106).

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 153

Let the vertices of the $n$-cube be identified with $n$-bit strings.

taocpmathematicsalgorithmsvolume-4hard
TAOCP 7.1.4 Exercise 152

Let $h_n$ denote the hidden weighted bit function on variables $x_1,\dots,x_n$, where the value of $h_n(x_1,\dots,x_n)$ is $x_k$ with $k = x_1 + \cdots + x_n$, interpreted in the standard way of Exerc...

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 151

Algorithm J performs _sifting_ by repeatedly moving a chosen variable through all possible positions in the variable ordering, exchanging it with adjacent variables to minimize the BDD size.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 150

Let $f_1,\dots,f_m$ be Boolean functions represented by a shared reduced ordered BDD, with node set size $B(f_1,\dots,f_m)$ in the sense of Section 7.

taocpmathematicsalgorithmsvolume-4hard
TAOCP 7.1.4 Exercise 15

Let $C_n$ have vertices $1,2,\dots,n$ with edges $i\sim i\pm1 \pmod n$.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 149

The central issue is that the original argument tries to maintain a global “ancestry” of nodes through repeated reductions.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 148

The reviewer is correct: the statement is **false**, so the original proof attempt cannot be repaired.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 147

Let level $0$ contain the root nodes of the BDD base, level $1$ the next variable layer, and level $2$ the layer below.

taocpmathematicsalgorithmsvolume-4hard
TAOCP 7.1.4 Exercise 146

Let level $0$ contain the root nodes of the BDD base, level $1$ the next variable layer, and level $2$ the layer below.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 145

Let the input variables be two binary words $x = x_1x_2x_3x_4,\qquad y = y_1y_2y_3y_4,$ and let $f_1,\dots,f_5$ denote the five output bits of the addition $x+y$ as defined in (36), where $f_1$ is the...

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 144

The addition functions $f_1, f_2, f_3, f_4, f_5$ in (36) are the Boolean functions that determine the carry propagation structure of binary addition for increasing word lengths, where $f_k(x_1,\dots,x...

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 143

Let $f(x)=\langle x_1^{w_1}\cdots x_{20}^{w_{20}}\rangle$ denote the self-dual threshold function in which the weights are those listed in the statement.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 142

Let $f(x)=\langle x_{w_1}\cdots x_{w_n}\rangle$ denote the threshold function defined in Section 7.

taocpmathematicsalgorithmsvolume-4hm-hard
TAOCP 7.1.4 Exercise 141

Let $d(n)$ denote the quantity arising in Exercises 45–47, interpreted as the number of Hamiltonian cycles produced by the Gray-cycle constructions in the $(kr+2)$-cube after the reductions and gluing...

taocpmathematicsalgorithmsvolume-4hard
TAOCP 7.1.4 Exercise 140

Number the vertices of the cycle $C_n$ as in the statement, so edges are ${x_i,x_{i+1}}$ for $1 \le i < n$ and ${x_n,x_1}$.

taocpmathematicsalgorithmsvolume-4hard
TAOCP 7.1.4 Exercise 14

Number the vertices of the cycle $C_n$ as in the statement, so edges are ${x_i,x_{i+1}}$ for $1 \le i < n$ and ${x_n,x_1}$.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 139

Let $k \ge 2$ be even and consider the $(kr+2)$-cube $G = G_k G_{k-1} \cdots G_1 G_0 G_{-1}$, where $G_i$ is an $r$-cube for $i>0$ and $G_0 = G_{-1} = P_2$.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 138

We interpret a QDD as a shared representation of all cofactors of $f$ with respect to a variable ordering, where each internal node is labeled by a variable and edges correspond to 0/1 restriction.

taocpmathematicsalgorithmsvolume-4math-project
TAOCP 7.1.4 Exercise 137

Let $\Gamma_6 = g(0), g(1), \dots, g(2^6-1)$ be the 6-bit Gray binary code, where g(k) = k \oplus \lfloor k/2 \rfloor.

taocpmathematicsalgorithmsvolume-4math-project
TAOCP 7.1.4 Exercise 136

Let $\Gamma_6 = g(0), g(1), \dots, g(2^6-1)$ be the 6-bit Gray binary code, where g(k) = k \oplus \lfloor k/2 \rfloor.

taocpmathematicsalgorithmsvolume-4math-hard
TAOCP 7.1.4 Exercise 135

Let $\Gamma_6 = g(0), g(1), \dots, g(2^6-1)$ be the 6-bit Gray binary code, where g(k) = k \oplus \lfloor k/2 \rfloor.

taocpmathematicsalgorithmsvolume-4math-hard
TAOCP 7.1.4 Exercise 134

Let $\Gamma_n = g(0), g(1), \dots, g(2^n-1)$ be the $n$-bit Gray binary code defined in Section 7.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 133

Let $\mathcal{S}(f)$ denote the set of all distinct subfunctions of $f(x_1,\dots,x_n)$ obtained by repeated Shannon decomposition with respect to variables $x_1,\dots,x_n$, as represented in the maste...

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 132

Let $f(x_1,x_2,x_3,x_4,x_5)$ be a Boolean function and let $B_{\min}(f)$ denote the minimum, over all variable orderings, of the number of nodes in its reduced ordered binary decision diagram, includi...

taocpmathematicsalgorithmsvolume-4hard
TAOCP 7.1.4 Exercise 131

Let C(x_1,\dots,x_p;\,y_{11},\dots,y_{pq}) = \bigwedge_{j=1}^{q}\left(\bigvee_{i=1}^{p}(x_i\wedge y_{ij})\right) be the covering function from the statement.

taocpmathematicsalgorithmsvolume-4math-hard
TAOCP 7.1.4 Exercise 130

Let $G=(V,E)$ be an ordinary (undirected) graph, viewed as a digraph by replacing each edge ${u,v}\in E$ with the two arcs $u\to v$ and $v\to u$.

taocpmathematicsalgorithmsvolume-4hm-hard
TAOCP 7.1.4 Exercise 13

Let $G=(V,E)$ be an ordinary (undirected) graph, viewed as a digraph by replacing each edge ${u,v}\in E$ with the two arcs $u\to v$ and $v\to u$.

taocpmathematicsalgorithmsvolume-4math-simple
TAOCP 7.1.4 Exercise 129

Let $S={1,\dots,m}$ denote the selector variables and $T={m+1,\dots,m+2^m}$ the data variables of the multiplexer $M_m$.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 128

Let $S={1,\dots,m}$ denote the selector variables and $T={m+1,\dots,m+2^m}$ the data variables of the multiplexer $M_m$.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 127

Let $h_n(x_1,\ldots,x_n)$ be the hidden weighted bit function and let $h_n^\pi$ denote its permutation under $\pi$, evaluated in the fixed variable order $x_1,\ldots,x_n$.

taocpmathematicsalgorithmsvolume-4research
TAOCP 7.1.4 Exercise 126

Let $h_n(x_1,\ldots,x_n)$ denote the hidden weighted bit function and let $h_n^\pi(x_1,\ldots,x_n)=h_n(x_{\pi(1)},\ldots,x_{\pi(n)})$ be its permutation by $\pi$.

taocpmathematicsalgorithmsvolume-4hm-project
TAOCP 7.1.4 Exercise 125

Let $h_n(x_1,\ldots,x_n)$ be the hidden weighted bit function, and let $B(h_n)$ denote the number of nodes in its reduced ordered binary decision diagram, including the two sink nodes $\bot$ and $\top...

taocpmathematicsalgorithmsvolume-4hm-hard
TAOCP 7.1.4 Exercise 124

Let a slate of offset $s$ be defined as in the construction preceding formula (97), where each slate is determined by a choice of $s$ distinguished positions among $n$ ordered positions, and offset me...

taocpmathematicsalgorithmsvolume-4hard
TAOCP 7.1.4 Exercise 123

Let a slate of offset $s$ be defined as in the construction preceding formula (97), where each slate is determined by a choice of $s$ distinguished positions among $n$ ordered positions, and offset me...

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 122

Let $h_n(x_1,\dots,x_n)$ denote the hidden weighted bit function, and let $x^\psi$ be the permutation on ${0,1}^n$ defined in part (c) of Exercise 121 by \epsilon^\psi=\epsilon,\quad (x_1\cdots x_n0)^...

taocpmathematicsalgorithmsvolume-4hard
TAOCP 7.1.4 Exercise 121

Let $f^{D}(x_1,\dots,x_n)=\overline{f(\overline{x_1},\dots,\overline{x_n})}$ and $f^{R}(x_1,\dots,x_n)=f(x_n,\dots,x_1)$.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 120

The hidden-weighted-bit function $h_n$ assigns a value to a bit vector $(x_1,\dots,x_n)$ by interpreting the input as indexing into a truth table and then extracting a selected bit.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 12

Let $\Gamma_n = {g(0), g(1), \ldots, g(2^n-1)}$ be the $n$-bit Gray binary code defined in Section 7.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 119

Let $N \ge 1$.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 118

Let $g(k)$ be the Gray binary code defined in (7), equivalently $g(k)=k\oplus \lfloor k/2\rfloor$ by (9).

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 117

Let $f = M_m(x_1,\ldots,x_m; x_{m+1},\ldots,x_{2m})$, where $M_m$ denotes the equality function on two $m$-bit blocks, so that $f=1$ if and only if $x_i = x_{m+i}$ for all $1 \le i \le m$.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 116

Let the quasi-profile of a BDD for a Boolean function $f(x_1,\dots,x_n)$ be the sequence $Q_k(f)$, where $Q_k(f)$ counts the number of distinct nodes (equivalently distinct subfunctions) at level $k$,...

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 115

Let $p_k$ denote the number of beads (BDD nodes) at level $k$, and let $q_k$ denote the number of distinct subtables produced at level $k$ before reduction, in the sense of Section 7.

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 114

Let the function depend on six variables $x_1,\dots,x_6$.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 113

Let $F_4$ denote the set of Boolean functions of four variables.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 112

Let $\hat b_k$ denote the quantity defined in (80) of Theorem U, where $\hat b_k$ is obtained from the recurrence counting BDD nodes via subtables of order $n-k$ and their bead structure.

taocpmathematicsalgorithmsvolume-4hm-medium
TAOCP 7.1.4 Exercise 111

Let $\Gamma_3 = (g(0), g(1), \dots, g(7))$ be the 3-bit Gray binary code in cyclic order, so consecutive terms including $g(7) \to g(0)$ differ in exactly one bit, by the defining property of Gray cod...

taocpmathematicsalgorithmsvolume-4math-medium
TAOCP 7.1.4 Exercise 110

Connection interrupted.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 11

Algorithm C in Section 7.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 109

Let the current composition of $n$ be s_1 s_2 \cdots s_j, and let

taocpmathematicsalgorithmsvolume-4hm-medium
TAOCP 7.1.4 Exercise 108

The solution does not correctly establish the required inequality.

taocpmathematicsalgorithmsvolume-4hm-medium
TAOCP 7.1.4 Exercise 107

Let $f(x_1,\dots,x_n)$ be a Boolean function represented by a reduced ordered BDD, and let $B(f)$ denote its number of nodes including sinks, as defined in Section 7.

taocpmathematicsalgorithmsvolume-4hard
TAOCP 7.1.4 Exercise 106

Let variables of $f$ be $x_1,\dots,x_n$, variables of $g$ be $y_1,\dots,y_n$, and variables of $h$ be $z_1,\dots,z_n$.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 105

A Boolean function $f(x_1,\dots,x_n)$ is unate with polarities $(y_1,\dots,y_n)$ when the function $h(x_1,\dots,x_n)=f(x_1\oplus y_1,\dots,x_n\oplus y_n)$ is monotone increasing in each variable, mean...

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 104

Let $f$ and $g$ be Boolean functions represented by reduced ordered binary decision diagrams with sink nodes $\bot,\top$ and with variable ordering $x_1 < \cdots < x_n$.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 103

Let \Phi(x_1,\dots,x_n) = \exists y_1 \dots \exists y_m \Bigl(

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 102

Let $f(x_1,\dots,x_n)$ be a Boolean function represented by its BDD as in Section 7.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 101

Let $\Sigma_m={0,1,\dots,m-1}$ be the ordered alphabet used for $m$-ary strings in Section 7.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 100

Let $G=(V,E)$ be the planar adjacency graph of the contiguous United States after eliminating DC, as specified in the exercise.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 10

Let $f$ and $f'$ be Boolean functions represented by reduced ordered BDDs.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 9

Let the BDD of $f(x_1,\ldots,x_n)$ be given in the sequential form of (8), with nodes $k_j$ labeled by $V(k_j)=x_j$, LO successor $\operatorname{LO}(k_j)$, HI successor $\operatorname{HI}(k_j)$, and s...

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 8

Let $f(x_1,\ldots,x_n)$ be given and let g_k(x_1,\ldots,x_n)=f(x_1,\ldots,x_{k-2},\,x_{k-1}\oplus x_k,\,x_{k+1},\ldots,x_n).

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 7

Let $f(x_1,\ldots,x_n)$ be represented by its reduced ordered BDD under variable order $x_1<\cdots<x_n$, and define $g_k(x_0,x_1,\ldots,x_n)=f(x_1',\ldots,x_n')$ where For truth tables, each entry of...

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 6

The truth table of $g(x_1,x_2,x_3,x_4)=f(x_4,x_3,x_2,x_1)$ is obtained by reversing the bit indices of the truth table of $f$.

taocpmathematicsalgorithmsvolume-4simple
TAOCP 7.1.4 Exercise 5

Let $G$ be the BDD of $f(x_1,\dots,x_n)$, and construct a transformed directed acyclic graph $G'$ by interchanging the LO and HI pointers of every branch node and swapping the two sinks $\bot \leftrig...

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 4

Let the 64-bit word $x$ contain fields V \mid LO \mid HI with $V$ occupying the highest 8 bits and each of $LO, HI$ occupying 28 bits.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 3

Let $f(x_1,x_2,\dots,x_n)$ be a Boolean function and let its BDD size $B(f)$ be the number of nodes in its reduced ordered BDD, including the sinks $\bot,\top$.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 2

Let $F$ be the set of all Boolean functions $f(x_1,x_2)$, represented by their truth tables f = (f(0,0), f(0,1), f(1,0), f(1,1)) \in \{0,1\}^4, so $|F| = 16$.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.4 Exercise 1

A BDD is an ordered reduced directed acyclic graph with variable ordering $x_1 < x_2$, sinks $\bot,\top$, and branch nodes labeled by variables.

taocpmathematicsalgorithmsvolume-4medium
TAOCP 7.1.3 Exercise 99

All operations act on octabytes bytewise, so the computation reduces to a single 8-bit word.

taocpmathematicsalgorithmsvolume-4hard