Quiz Space

Advanced Algorithms · End Term · 3 Sept 2023 · May 2023 term · Set QPE1-S1

Question 27: Consider the followed randomized algorithm, which prints…

Question 27

+3 marksOne correct option

Consider the followed randomized algorithm, which prints out some number of smiley faces (:)) and some number of asterisks (∗*) :

python
def randomizedSmiles (A):
n = len(A)
if n ≤ 1:
print ":)"
return
for i in {0,...,n-1}:
print "*"
Choose a uniformly random integer p in {1, \ldots, n-1}
randomizedSmiles(A[:p])
randomizedSmiles (A[p:])

For the following parts, choose the tightest big-Oh bound that applies.

Based on the above data, answer the given subquestions.

  1. A
  2. B
  3. C
  4. D
  5. E
Show answer

Correct answer

  • C

Question 27 of 34 in the IIT Madras BS Advanced Algorithms (Advanced Algorithms) End Term paper sat on 3 Sept 2023, in the May 2023 term (IIT M DEGREE ET1 EXAM QPE1 S2 03 Sep). It carries 3 marks.

More questions from this paper

  1. Q1Recall the Dance Class problem: Problem Definition Dance Classes Input: A collection of n intervals given by their left…
  2. Q2Figure question
  3. Q3True or false?
  4. Q4Figure question
  5. Q5Raj and Lata both designed an algorithm for the same minimization problem. Raj proved that his algorithm Alg1 is a 5-ap…
  6. Q6Recall the max-flow problem: for a directed graph G(V, E) with non-negative capacities c_e for every e \in E and two sp…
  7. Q7Figure question
  8. Q8Recall the Dance Class problem: Problem Definition Dance Classes Input: A collection of n intervals given by their left…
  9. Q9Recall the Stable Matching problem: Problem Definition Stable Matching Input: Two sets given by M = {m_1, \ldots, m_n} …
  10. Q10Is the collection of outgoing 1/2-factors over the set A a matroid?
  11. Q11Is the collection of incoming 1/2-factors over the set A a matroid?
  12. Q12Is the collection of 1-factors over the set A a matroid?
  13. Q13Can the collection of 1-factors be defined as the intersection of two matroids?
  14. Q14Based on the above data, answer the given subquestions.
  15. Q15The memory of Bob's computer contains two interesting things: an array of integers and a virus. Each midnight the virus…
  16. Q16The memory of Bob's computer contains two interesting things: an array of integers and a virus. Each midnight the virus…
  17. Q17The memory of Bob's computer contains two interesting things: an array of integers and a virus. Each midnight the virus…
  18. Q18The memory of Bob's computer contains two interesting things: an array of integers and a virus. Each midnight the virus…
  19. Q19The memory of Bob's computer contains two interesting things: an array of integers and a virus. Each midnight the virus…
  20. Q20Consider the network given below with source s and sink t, with the numbers on the edges denoting maximum capacity acro…
  21. Q21Figure question
  22. Q22Consider the network given below with source s and sink t, with the numbers on the edges denoting maximum capacity acro…
  23. Q23Consider the following orientation problem. We are given an undirected graph G = (V, E) and integer values p(v) for eve…
  24. Q24Consider the partially carefully properly 5-colored graph below. What color should we give the vertex in the center to …
  25. Q25Is this problem NP-complete? Hint. You may assume that determining if a graph G has a proper 5- coloring is NP-complete.
  26. Q26In the Uncapacitated Facility Location (UCFL) problem, we are given (\mathcal{F} \uplus \mathcal{D}, d) as well auxilia…
  27. Q28Consider the followed randomized algorithm, which prints out some number of smiley faces (:)) and some number of asteri…
  28. Q29Consider the followed randomized algorithm, which prints out some number of smiley faces (:)) and some number of asteri…
  29. Q30Consider the followed randomized algorithm, which prints out some number of smiley faces (:)) and some number of asteri…
  30. Q31Based on the above data, answer the given subquestions.
  31. Q32Based on the above data, answer the given subquestions.
  32. Q33Based on the above data, answer the given subquestions.
  33. Q34Recall the Traveling Salesman Problem: Definition Traveling Salesman Problem Input: A set of distinct cities {c_1, c_2,…