Weekly Topic: Algorithmic Schemas
This year, we try to unite divide & conquer, greedy and searching over the state space under the topic of algorithmic schemas, as they refer to more of algorithmic thinkings than concrete algorithms.
Problem Set
Divide & Conquer
- Closest Pair: Given n (n≤106) points in a 2-D plane, find the pair of points that are closest to each other.
Binary Search
Suppose you have a sorted array, and you want to find whether a certain value x is in the array. We can start at the middle location, and check whether the value is x. If the value v is x, then we are done, else we can move to the left or right side.
Estimate the Time Complexity
It might be important to notice the time complexity of the divide and conquer algorithm.

- T(n)=k⋅T(nk)+t(n)
- ⇒T(n)=kα⋅T(1)+∑i=0α−1(ki⋅t(nki))
- ⇒T(n)=logk(n)=kα+⎧⎩⎨⎪⎪⎪⎪if t(nk)=O(1),∑i=0α−1(ki)≈n⇒O(n)if t(nk)=O(n),∑i=0α−1(n)≈αn⇒O(nlogn)

Greedy
Searching
- Complete search (all permutations)/state space traversal (DFS, BFS) + other topics (DP, computational geometry, graph…)/data structure (priority queue, bitmask, segment tree, …)