0% found this document useful (0 votes)
6 views3 pages

Basic Algorithm HW3

The document outlines a homework assignment for a Basic Algorithms course, due on February 20, 2025. It includes three problems: finding the peak of a distinct integer array using a sublinear algorithm, developing a divide-and-conquer method to find the median of two databases, and proving that a 2n × 2n grid with one black square can be tiled with L-shaped tiles. Each problem specifies points awarded and requires justification of the proposed algorithms' correctness and time complexity.

Uploaded by

yfzhang30658
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Basic Algorithm HW3

The document outlines a homework assignment for a Basic Algorithms course, due on February 20, 2025. It includes three problems: finding the peak of a distinct integer array using a sublinear algorithm, developing a divide-and-conquer method to find the median of two databases, and proving that a 2n × 2n grid with one black square can be tiled with L-shaped tiles. Each problem specifies points awarded and requires justification of the proposed algorithms' correctness and time complexity.

Uploaded by

yfzhang30658
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Name: Basic Algorithms (Section 5) HW3 (Due 2/20 23:59)

Net ID: Spring 2025 Instructor: Jiaxin Guan

Problem 1 (Divide and Conquer the Peak, 30 pts)

Suppose we have an array A of n distinct integers and moreover are guaranteed that the
array has the following property: up to some index 1 ≤ i ≤ n, A is increasing, i.e., A[1] <
A[2] < . . . < A[i], and then after index i, A is decreasing, i.e., A[i] > A[i+1] > . . . > A[n]. In
this array, we call A[i] the peak of A. For example, consider the array [1, 4, 7, 8, 6, 2], which
has peak 8.
Create an algorithm that finds the peak of an input array A in sublinear time (i.e. o(n)).
Justify the correctness and time complexity of your proposed algorithm.

Discussion Partners: 1
Name: Basic Algorithms (Section 5) HW3 (Due 2/20 23:59)
Net ID: Spring 2025 Instructor: Jiaxin Guan

Problem 2 (Two-Server Search, 35 pts)

You have (limited) access to two databases, each of which contains n numbers. For simplicity,
you may assume each value across the 2n entries is unique. You may only query the databases
in the following way: You give one of the databases an integer 1 ≤ k ≤ n, and it responds
with the k-th smallest number in its database.
Give a divide-and-conquer algorithm that finds the median value across all 2n entries using
O(log n) queries to the servers. Justify the correctness and time complexity of your proposed
algorithm.

Discussion Partners: 2
Name: Basic Algorithms (Section 5) HW3 (Due 2/20 23:59)
Net ID: Spring 2025 Instructor: Jiaxin Guan

Problem 3 (Grid Tiling, 35 pts)

For a positive integer n, consider a 2n × 2n grid, where one of the unit squares is black and
all others are white. Show that regardless of the position of the black unit square, the white
area can be fully covered, without any overlapping, by L-shaped tiles consisting of 3 unit
squares (rotations are allowed).

Left: an example grid with n = 3; Right: the L-shaped tile

(Hint: Use a proof by construction, i.e. design a divide-and-conquer algorithm that takes as
input n and (i, j) with 1 ≤ i, j ≤ 2n , and outputs a way to tile a 2n × 2n grid with the black
square at position (i, j).)

Discussion Partners: 3

You might also like