• Nem Talált Eredményt

Is it possible that following pictures show red-black trees? (Leaves are not shown, black circle means black vertex, white square denotes red vertex.) 4

N/A
N/A
Protected

Academic year: 2022

Ossza meg "Is it possible that following pictures show red-black trees? (Leaves are not shown, black circle means black vertex, white square denotes red vertex.) 4"

Copied!
1
0
0

Teljes szövegt

(1)

Theory of Algorithms Exam June 1st, 2016

1. Letf(n) = 3√

n+ 2n2+ 2log2n. Give an appropriate constantcand threshold valuen0 and show using them that f(n) =O(n3).

2. Consider grammar A → aAB | BC B → b BC → Aa | B. Is this grammar context-free? If not, then make it context-free so that the result generates exactly the same words as the original one does.

3. Is it possible that following pictures show red-black trees? (Leaves are not shown, black circle means black vertex, white square denotes red vertex.)

4. Let the alphabet be Σ ={0,1}, furthermore letM be an incomplete finite automaton that has 5 states and 8 transitions. If we make it complete using the procedure studied in class, then how many states and how many transitions will the result have?

5. Let array A store n elements. How can a pair of indices i6=j be found using O(nlogn) comparisons that satisfies |A[i]−A[j]|<100?

6. Is it in Por is it NP-complete the version of BinPackingproblem, where each weight is either 1/4 or 4/5?

7. The edges of simple graph G(V, E) are weighted. We want to find a subsetX ⊆E of maximum total weight such that every vertex in V is incident with at most 3 edges from X. Formulate this problem as an integer programming problem.

8. During summer there will many festivals be held that are interesting for us, unfortunately, there are overlaps between the dates of some of the festivals. If we go to a festival, then we want to stay there from the first day till the last day, however, the day after the last day of a festival we may immediately go to another festival. There are f festivals in question, the start and end days of each are known. Our goal is to spend as many days on festivals as possible, that is we want to maximize the number of days spent on festivals. Give an O(f2) time algorithm that solves this problem. (hint: formulate the problem as a graph theory question involving DAG’s.)

Results without proper reasoning receive no credit. It is forbidden to seek or give help from/to others, as well as usage of any electronic device, or written notes. Mobile phones must be switched off.

Hivatkozások

KAPCSOLÓDÓ DOKUMENTUMOK

Besides the colour differences: legs are black and white and body is richly decorated with white spots; the new species has black body without white spots and legs are red and

We also think that it is possible to put matroid constraints on the outgoing edges of each vertex as well but this generalization contains the Matroid intersection conjecture

The main goal is to minimize the amount of the off-grade product, so reduce the grade transition time as much as possible to show that there are reserved, untapped possibilities

Our final implementation uses a red-black tree to store fil- tered transactions, item order is ascending according to their support, simultaneous traversal is used as a routing

The first question we investigate is whether it is always possible to partition the vertices in a balanced way into k classes such that the number of pairs of classes that are

For F -Subgraph Test , we show that if every graph of a hereditary class F satisfies the property that it is possible to delete a bounded number of vertices such that every

In the following we show that it is possible to select a subset LF 0 ⊆ LF such that there exists a subtree of weight at most B that contains each vertex of LF 0 , and furthermore, if

It is important to note that the range of the RED process (i.e. We have shown also that the RED of Ag in Ni induced by ion bombardment results in a diffusion