Consider the metric Facility Location problem. A company wants to distribute its product to various cities. There is a set I of potential locations where a storage facility can be opened and a fixed “facility cost” fi associated with opening a storage facility at location i∈I. (Sometimes we will say “facility i” to mean “facility at location i”). There also is a set J of cities to which the product needs to be sent, and a “routing cost” c(i,j) associated with transporting the goods from a facility at location i to city j. The goal is to pick a subset S of I so that the total cost of opening the facilities and transporting the goods is minimized. In short, we want to minimize C(S)=Cf(S)+Cr(S), where Cf(S)=∑i∈Sfi and Cr(S)=∑j∈Jmini∈Sc(i,j). Consider the following local serach algorithm:
There are two types of “local steps” that we take in searching for a neighbor: i) remove/add a facility from/to the current feasible solution, or ii) swap a facility in our current solution with one that is not.
Which of the following statement is true?
In a character set S consisting of 5 characters, given their occurrence frequencies being 3, 5, 7, 11 and 14, the weighted average length of Huffman codes for S is:
Merge the two leftist heaps in the figure. How many of the following statements is/are FALSE ?
How many of the following arguments are correct?
If we insert N(N⩾2) nodes (with different integer elements) consecutively to build a red-black tree T from an empty tree, which of the following situations is possible:
After inserting 15 into the Skew Heap in the figure, which of the following statements is correct for the resulted Skew Heap?
The Merging problem is to merge two non-decreasing arrays A(1), A(2), ..., A(n) and B(1), B(2), ..., B(n) into another non-decreasing array C(1), C(2), ..., C(2n). To solve it in parallel, we turn it into a Ranking problem. That is, to compute RANK(A(i),B) and RANK(B(i),A) for every 1≤i≤n, where RANK(e,S) is the position of e
in S
.
wherefor Pi, 1<=i<=n pardo RANK(A(i),B) := BS(A(i),B) RANK(B(i),A) := BS(B(i),A)
BS(e,S)
is to find the position of e
in S
by binary search.i = j = 0; while ( i ≤ n || j ≤ m ) { if ( A(i+1) < B(j+1) ) RANK(++i, B) = j; else RANK(++j, A) = i; }
How many of the following statements are True?
In a binomial queue, we donote the total number of the nodes at even depth and odd depth as N1 and N2, respectively (the root is defined to be at the depth 0). Which of the following statements is FALSE?
Consider the following function, where the time complexity for function calc()
is O(1).
void fun(int l, int r) { if(r-l+1<=1234) return; int m=(l+r)/2; int m1=(l+m)/2, m2=(m+1+r)/2; fun(l, m); fun(m1+1, m2); for(int k=1;k<=r-l+1;k++) for(int i=1;i<=r-l+1;i++) for(int j=l;j<=r;j+=i) calc(j, i); fun(m+1, r); fun(m1+1, m2); }
Assume the initial input is l=1, r=N
, What is the running time of this function? Your answer should be as tight as possible.
For the Maximum Finding, how many of the following statements are True?
To find the kth smallest number in a set S, randomized quick selection algorithm works in the following way:
If ∣S∣=n, then the best upper bound of the expected time complexity of this algorithm is:
Given the following game tree, node d will be pruned with α−β pruning algorithm if and only if _____.
In external sorting, suppose we have n runs of lengths 20,21,…,2n−1, respectively. To obtain the minimum merge time, which of the following statement is FALSE?
A sum list L is a data structure that can support the following operations:
Now we would like to show that any sequence of Insert and Sum operations can be performed in O(1) amortized cost per insert and O(1) amortized cost per Sum. Which of the following statement is TRUE?
We all know how to use the binary search method to find a value in a monotonic array. As an extension, we will use the ternary search method to find the extremum in a quadratic-function-like array. Formally, for an array a, let k be the position of its extremum. Then we have either a[1]<...<a[k−1]<a[k]>a[k+1]>...>a[n] or a[1]>...>a[k−1]>ak<a[k+1]<...<a[n]. Apply the ternary search method to locate k. For a given interval 1≤l<r≤n, locate the two trisection points in [l,r] as m1=l+⌊3r−l⌋ and m2=l+⌊32(r−l)⌋. Assuming we are looking for the minimum value, which of the following pieces of code can correctly narrow down the target interval?
When searching for the keyword "game theory" on Google, the first four results returned are as follows:
Doc | Text |
---|---|
1 | Game theory is the study of mathematical models of strategic interactions among rational agents. It has applications in many social science fields. |
2 | Game theory is the study of how players strategize and make decisions. It's a way to model scenarios in which conflicts of interest exist among the players. |
3 | Game theory is a branch of applied mathematics that provides tools for analyzing situations in which players make interdependent decisions. |
4 | Hello Internet! Welcome to GAME THEORY! If you are like us, then you have probably wondered about the secrets hidden in your favorite games. |
Now if we construct an inverted file index for the results shown above, ignore case(忽略大小写)and do word stemming, please fill in the blanks in the inverted file index (not complete) below:
No. | Term | Times; Documents; Words |
---|---|---|
1 | game | ⟨5;(1;1),(2;1),(3;1),(4;5),(4;24)⟩ |
2 | strategy | ⟨2;(1;10),(2;1◯)⟩ |
3 | apply | ⟨2;(1;17),(3;7)⟩ |
4 | math | ⟨2;(1;7),(2◯;8)⟩ |
… | … | … |
For the result of accessing the keys 2 and 3 (in order) of the splay tree in the figure, which one of the following statements is FALSE ? (Note: the numbers are the indices of the nodes, not the key values.)
Which of the following statements about binomial queue is FALSE?
Consider the 0-1 knapsack problem with object weights w, profits v, and total weight limit B (means that w of any object is no larger than B.). In the class, we have learned that combining the greedy algorithm on maximum profit v and maximum profit-weight ratio v/w leads to an approximation algorithm which always produces a solution no less than 1/2 of the optimal solution. Now let us consider the following simplified greedy algorithm. The algorithm first conducts the following sorting w.r.t. profit-weight ratio:
Let the sorted order of objects be a1,…,an. The next step is to find the lowest k such that the total weight of the first k objects exceeds B. Finally, we pick the more valuable of {a1,…,ak−1} and {ak} as the final solution. Then which of the following arguments is correct: