Let $T(1) = O(1)$. Prove:
Master theorem:
\[T(n) = a T(n/b) + O(n^c) = \begin{cases} O(n^c) & a < b^c \\ O(n^c \log n) & a = b^c \\ O(n^{\log_b a}) & a > b^c \end{cases}\]Describe an algorithm which, given a list of points ${p_1}, {p_2}, \dots, {p_n}$ in $\mathbb{R}^2$, deletes the repeated points, i.e., returns the set $\lbrace {p_1}, {p_2}, \dots, {p_n} \rbrace$. The time complexity should be $O(n \log n)$.
Describe the algorithm for the same problem in $\mathbb{R}^d$. What is its time complexity?
We are given $n$ segments in a plane. We know that the segments are the edges of a polygon, but they are not necessarily given in the “right” order. Describe an algorithm which reconstructs the polygon as a list of consecutive vertices in $O(n \log n)$ time.
For the points $p = ({p_x}, {p_y})$, $q = ({q_x}, {q_y})$ and $r = ({r_x}, {r_y})$ in a plane, we define
\[D(p, q, r) = \begin{vmatrix} 1 & p_x & p_y \\ 1 & q_x & q_y \\ 1 & r_x & r_y \end{vmatrix} .\]Base case:
Scaling by a factor $k \ne 0$: \(D(kp, kq, kr) = \begin{vmatrix} 1 & k p_x & k p_y \\ 1 & k q_x & k q_y \\ 1 & k r_x & k r_y \end{vmatrix} = k^2 D(p, q, r)\)
Translation by $(x, y)$: \(D(p + (x, y), q + (x, y), r + (x, y)) = \begin{vmatrix} 1 & p_x + x & p_y + y \\ 1 & q_x + x & q_y + y \\ 1 & r_x + x & r_y + y \end{vmatrix} = D(p, q, r)\)
Rotation by $\alpha$ around the origin: \(D(R_\alpha(p), R_\alpha(q), R_\alpha(r)) = \begin{vmatrix} 1 & \cos(\alpha) p_x + \sin(\alpha) p_y & -\sin(\alpha) p_x + \cos(\alpha) p_y \\ 1 & \cos(\alpha) q_x + \sin(\alpha) q_y & -\sin(\alpha) q_x + \cos(\alpha) q_y \\ 1 & \cos(\alpha) r_x + \sin(\alpha) r_y & -\sin(\alpha) r_x + \cos(\alpha) r_y \end{vmatrix}\)
\[= \begin{vmatrix} 1 & p_x & p_y \\ 1 & q_x & q_y \\ 1 & r_x & r_y \end{vmatrix} \cdot \begin{vmatrix} 1 & 0 & 0 \\ 0 & \cos(\alpha) & -\sin(\alpha) \\ 0 & \sin(\alpha) & \cos(\alpha) \end{vmatrix} = D(p, q, r)\] \[D(p, q, r) = p_x q_y + q_x r_y + r_x p_y - p_x r_y - q_x p_y - r_x q_y\]Describe an algorithm which computes the intersections of a given line with a given circle in a plane.
You are given a set $P$ of points in the plane. Find all collinear tuples of points in $O(n^2 \log n)$ time.