No history yet

Final Exam

 

1.When calculating ab(modm)a^b \pmod{m} in competitive programming, why is binary exponentiation preferred over a simple loop?

 

2.What does Euler's Totient Function, ϕ(n)\phi(n), calculate?

 

3.Under which condition is it necessary to use the Bellman-Ford algorithm instead of Dijkstra's algorithm for finding the single-source shortest path?

 

4.True or False: In a Disjoint Set Union (DSU) data structure, the primary purpose of 'path compression' is to flatten the tree structure during find operations, leading to nearly constant-time complexity for future operations.

 

5.Which statement best describes a key difference between memoization (top-down) and tabulation (bottom-up) in dynamic programming?

 

6.Bitmask DP is most suitable for solving problems on subsets where the total number of items (N) is very small. What is a typical upper bound for N in such problems?

 

7.For which of the following tasks is the Aho-Corasick algorithm the most efficient tool?

 

8.A major weakness of using a polynomial rolling hash for string comparison is the possibility of collisions. How can the probability of collisions be significantly reduced?

 

9.In computational geometry, what fundamental property is determined by calculating the sign of the 2D cross product of two vectors originating from a common point (e.g., vectors PQ and PR)?

 

10.Which algorithm design paradigm is exemplified by the Sweep Line technique used for problems like finding all intersections of a set of line segments?

 

11.You are given a range query problem on a static array. The constraints are N (array size) up to 10^5 and Q (number of queries) up to 10^5. Standard segment trees or Fenwick trees are too complex to implement for the query type. Which technique is specifically designed for such offline range queries and has a complexity of O((N+Q)N)O((N+Q)\sqrt{N})?

 

12.What is the primary goal of 'stress testing' in a competitive programming context?

All done? Get your grade