Construct a set cover problem instance whose universe is the set of edges . For each vertex , supply the set of all edges incident to . A collection covers the universe if and only if every edge has an endpoint in , which is precisely the vertex cover condition.
The correspondence preserves cardinality: a vertex cover of size is a feasible solution of the set cover problem using of these sets, and conversely. If two labelled vertices produce identical sets, one can keep their labels or discard duplicate choices without changing the optimum. The construction has size when incidences are listed, so it is a polynomial-time reduction.
For a finite undirected graph , a vertex cover is a subset meeting every edge: for every , at least one of belongs to . The optimization problem asks for a vertex cover of minimum cardinality. Its usual decision version also supplies an integer and asks whether one exists with .
Use the usual bottom-up splaying operations. We prove the stronger result that at most three successful calls suffice. No insertions or deletions are needed.
If the chosen key is the minimum stored key, first perform splaying on and then on its immediate successor. The argument for consecutive keys in a binary search tree makes the left child of the successor with an empty right subtree; minimality makes its left subtree empty too. Hence is a leaf of a rooted tree. The maximum-key case is the mirror image.
Suppose is an interior key. Since at least four keys are stored, there are either two keys larger than or two smaller than . In the former case choose four consecutive stored keys
where is the predecessor of , and are the next two successors. Perform .
Here is a complete check of the local shapes. After the first call, is the root. After the second, is the root; every key below is in its left subtree , and every key above stays in the right subtree of . These outside subtrees cannot interfere with the next search. Between and there are only . The last step of splaying on is either a zig step, leaving as its right child; a zig-zag step, with the same result; or a zig-zig step, leaving some as its right child with immediately to the right of . Consequently the possible right subtrees of are exactly among these four forms, using for a node with its left and right subtrees:
Here an unexpanded or denotes a node with no children. Each row follows by the indicated one or two tree rotations in each bottom-up step. All rows end with as the right child of , with both its subtrees empty. If instead two keys below are available, reflect the construction, exchanging left and right and reversing the order of keys. This proves splaying a chosen node into a leaf for every node of every splay tree of size at least four.
Write . After splaying on , that key is at the root, and is the smallest key in its right subtree. This uses the integer assumption: no stored key lies strictly between and . Thus has an empty left subtree while it remains within the right subtree of .
Now perform ordinary bottom-up splaying on . Until the final step involving , all tree rotations occur below and leave it at the root. There are only two possible final cases.
  • If is the right child of , a single zig step rotates above , placing immediately to its left.
  • Otherwise is a grandchild of . Its parent lies in the right subtree of and must satisfy . Hence the last two directions are right then left. A zig-zag step rotates above and then above , again placing immediately to its left. A right-right final configuration is impossible because is the minimum of this subtree.
Therefore becomes the left child of . The argument applies more generally to consecutive keys in a binary search tree, even when their numerical difference is not one.
Use the conventional bottom-up red-black tree insertion: insert a red node by the binary search tree rule, repair a red parent with recolouring or tree rotations, and make the root black. Write and for black and red. The first three insertions give root , with on the left and on the right.
Inserting as the left child of gives a red parent and a red uncle. Recolour black and retain a black root . Inserting then gives the inner configuration ––. A left tree rotation at , followed by a right tree rotation at , produces a subtree rooted at with and beneath it. Finally insert to the left of . Its uncle is red, so recolour black and red. No further repair is required because has black parent .
The final root is ; its left child is and its right child is . Under are on the left and on the right; has left child . All omitted children are black null sentinels. Each root-to-null graph path has two real black nodes, and no red node has a red child.
Figure 1.
The red-black tree after the six insertions, with colours also marked B and R
. Details.
No. In a red-black tree with no red nodes, equal black height forces every graph path from the root to an absent-child position to have the same length. A real node cannot have exactly one real child: the two paths through that node would then have different numbers of black nodes. Recursively, every real level must be full. The tree is therefore a perfect binary tree.
With real levels its size is . A size of would require , which is impossible for an integer . The black null sentinels are not counted among the stored entries. This is the all-black red-black tree size criterion.
First perform splaying on the key to be deleted, making its node the root of a tree. Delete that root, leaving left and right subtrees . If either is empty, return the other. Otherwise find the maximum key of by following right-child references, and perform splaying on within . This makes the root of with an empty right subtree. Attach there. The result is the original splay tree with exactly the selected key removed. An unsuccessful lookup leaves the represented set unchanged.
For algorithm correctness, all keys of are smaller than the deleted key, and all keys of are larger. Splaying preserves the binary search tree property by the permitted assumption. Since is the maximum of , it has no larger key within ; since every key of exceeds , attaching as its right subtree preserves every ordering condition. All remaining keys occur once. This is the join-based deletion of a splay tree.[ref]
A binary search tree is a binary tree storing distinct keys from a total order, with every key in a node's left subtree smaller than that node's key and every key in its right subtree larger. The condition concerns entire subtrees, not just immediate neighbours.
For membership, start at the root of a tree and compare the target with the current key. Return true on equality; continue into the left subtree for a smaller target and the right subtree for a larger target; return false on an empty subtree. The binary search tree ordering ensures that a discarded subtree cannot contain the target. Each step descends one level, so the algorithm terminates and uses time complexity for height of a binary tree , under constant-time key comparison.
Order the edges arbitrarily and fix their colours one at a time. After a partial assignment , regard all unassigned edges as independent fair red/blue choices, and compute
The conditional expectation of a monochromatic clique count is easy to compute. For each four-vertex subset , let be the number of its six edges still unassigned. Its contribution to is
In the second case, every remaining edge must match the already fixed colour; this includes a completely fixed monochromatic copy, for which and the contribution is one. In the last case, the six unassigned edges may become either all red or all blue. By linearity of expectation,
For the next unassigned edge , compute and . The law of total expectation gives
Choose the colour with the smaller value, resolving a tie by a fixed rule. At least one is at most their average, so the loop invariant is that never increases. Initially ; once every edge is fixed, there is no randomness left and . Therefore the method of conditional expectations guarantees
A direct implementation recomputes both sums over all four-vertex subsets for each of the edges, requiring arithmetic operations. The comparisons can be exact: every contribution is a multiple of , so store as an integer with bits. This gives bit complexity with elementary arithmetic, and hence a deterministic polynomial time construction. No random sampling is performed by this derandomization.
Set . Independently sample an edge coloring exactly as in part (d), count its monochromatic copies of by examining all four-vertex subsets, and accept precisely when . Otherwise start over with a fresh edge coloring.
To prove an expected polynomial time bound, the existence argument alone is insufficient: we need a lower bound on the acceptance probability at this exact threshold. Since is a nonnegative integer with expectation , rejection implies . Markov's inequality therefore gives the integer-valued expectation threshold restart bound
The number of attempts has a geometric distribution, with expectation at most . Sampling the edge coloring costs random bits, and checking all four-vertex subsets costs operations, since only six edges must be tested per subset. Hence
This is a randomized algorithm that always returns an edge coloring meeting the original threshold and terminates with probability one. The stated operation count uses -bit counters; counting their bit complexity explicitly introduces at most a further logarithm factor and still gives polynomial time. For , return any edge coloring immediately.
Colour each edge of the complete graph independently red or blue, with probability for each colour. Every four-element subset of vertices determines exactly one copy of , containing six edges. These six edges are all red with probability and all blue with probability . The events are disjoint events, so
Let be the indicator random variable for this event and let count the monochromatic copies. Linearity of expectation gives
The indicator random variables for overlapping copies need not be independent. Averaging over all edge colorings ensures that at least one has . Thus the probabilistic method proves
For , both sides are zero and any edge coloring works. Copies are counted by their four-vertex subsets, rather than by their possible labellings.
Use uniform balanced binary sequence sampling by choosing the positions of the heads. Number the positions from zero to . Start with no selected positions. Repeatedly toss the fair coin times, interpret the resulting bits as a position, and select that position if it has not already been selected; otherwise discard this block of tosses and retry. Stop when distinct positions have been selected. Put heads at those positions and tails everywhere else.
After positions have been selected, every one of the remaining positions has the same probability of being the next new position. This follows either by summing a geometric series over rejected blocks or by conditioning a uniform distribution on a finite set on avoiding the selected positions. Every ordered list of distinct selected positions consequently has probability
Each fixed -element subset has such orders, so its probability is
Thus every balanced binary sequence is equally likely.
When positions are selected, a block succeeds with probability , so the geometric distribution gives expectation blocks until the next new position. By linearity of expectation, the total expected toss count is
The strict inequality holds since , making each term less than two. A Boolean array records membership of each position; initializing it and constructing the output require additional work. The scheme terminates with probability one, since every stage has positive success probability.
Betty's scheme is biased for every . The output occurs precisely when the first tosses are heads: the algorithm stops there and appends tails. Thus
For comparison, take the output . Its first symbols contain heads and tails, so neither stopping threshold has been reached. The next symbol is the th head, at which point the last tail is appended. Its unique generating prefix has length , giving
Therefore
The faster stopping rule does not produce a uniform distribution on a finite set of balanced binary sequences. For example, at the six outputs have the following exact probabilities:
OutputBettyUniform target
HHTT
HTHT
HTTH
THHT
THTH
TTHH
For , the two possible outputs each have probability , so that special case is uniform. For , simply return the empty output.
A trial of Amy's rejection sampling uses exactly fair Bernoulli trials. Exactly of the equally likely binary sequences have heads, so the acceptance probability is
Independent retries make the number of trials a geometric random variable on with expectation . The total number of coin tosses is , so
Using Stirling's approximation, the central binomial coefficient satisfies
Consequently
The rejection sampling output is uniform among the balanced binary sequences: they have equal probability on every trial, and conditioning on acceptance preserves that equality. For , the empty output needs zero tosses; the formula above concerns .
The expectation from part (f) is the average of over the finite collection of permutations. At least one value is as large as its average. By part (e), the corresponding is an independent set, so
Here is the independence number. Since its value is an integer, one can equivalently round the right side up with the ceiling function. This application of the probabilistic method is the Caro-Wei bound.
Choose a uniform random permutation of the vertices, giving every one of the orders the same probability. For a fixed vertex , consider together with its graph neighbours. The relative order of these vertices is uniform, so each is equally likely to be first. The membership rule for therefore gives
Let be the indicator random variable of this event. The cardinality is , and linearity of expectation gives
The indicator random variables are generally dependent; only the uniform random permutation and linearity of expectation were needed. An isolated vertex has and is always included, as the formula correctly predicts.
Consider any edge of the simple graph. One endpoint comes first in the permutation ; suppose it is . Then has a graph neighbour preceding it, namely , so . Therefore no edge has both endpoints in :
This argument uses only the order of the endpoints, with no random choice required.
If the bound in part (c) were available, the intended answer would be
Indeed , so that bound would give . Its growth is in Big O notation. Because (c) is false, this substitution alone does not prove the result for the actual repeated singleton-removal allocation.
The requested order can nevertheless be established for the actual process. Here is a concrete, deliberately generous replacement, with for the empty system:
The large cutoff makes the numerical estimates below simple. A finite initial range does not affect the asymptotic analysis.
First, whenever , a ball is served with probability at least
Thus part (a) gives , also for . The law of total expectation yields . This proves for the small- branch, including , whose single ball is served immediately.
For the large- branch, we need control of the random count, rather than an unjustified recurrence for its expectation. If balls are allocated in a round, changing one chosen bin changes the number of singleton bins by at most two. The surviving count therefore has the bounded differences property with constants . McDiarmid's inequality gives
This can be applied conditionally after any history, since the next allocations are fresh independent random variables.
Use this concentration inequality in three stages. Write .
  • For the first eight rounds, whenever , the conditional expectation is at most . Taking shows that the next count is at most , except with probability at most . If the count has already fallen below , it stays there. Since and , this gives outside the stated exceptional events.
  • Starting with , set . If and , part (a) and the union bound give . Taking gives a next count at most , except with probability at most . The deterministic solution is . It falls below within steps. After reaching that threshold the count cannot increase, so outside the exceptional events.
  • From , the next conditional expectation is at most . A deviation leaves at most balls except with probability . From at most balls, the next conditional expectation is at most . Taking leaves at most balls except with probability . Conditional on this final count bound, one more round has expectation at most .
Every exceptional probability above is at most , and there are at most opportunities for an exception. For , the elementary bounds and give, by the union bound, total exceptional probability at most . The first numerical inequality holds at the cutoff and remains true because is increasing there. On an exceptional history there are at most balls. Taking the last round's conditional expectation and then averaging gives
This proves the displayed replacement for the literal process without relying on either false assertion.
The printed bound also fails for the actual expectations. In the two-bin counterexample from part (b), at the true value and proposed bound are
The supplied premise does hold in this example: . Thus the problem is the invalid recurrence in part (b), rather than failure of the supplied starting estimate.[ref]
The intended mathematical induction is valid conditionally on the recurrence. For a deterministic nonnegative sequence satisfying and , the base case is . If , then
This proves the proposed form for but cannot identify with .
Figure 1.
Exact two-bin survivor expectation and the invalid printed bound
. Details.
There is no proof of the printed assertion: it is false for the stated expectations. The original explicitly defines as the expected remaining count, so replacing it by a deterministic upper envelope changes the problem.[ref]
Let be the actual count after rounds and . The union bound gives the valid conditional estimate
By the law of total expectation, the resulting unconditional bound is
Discarding the variance term is an expectation closure error for a nonlinear recurrence. In particular, Jensen's inequality says , which cannot justify the requested upper bound.
For an exact counterexample, start with two balls and two bins. A round serves both balls if they land separately and serves neither if they collide. Each outcome has probability , independently in successive rounds while both balls remain. Consequently
At , the requested inequality would say , but

There are unlisted articles, also show them or only show them.