Question 1. There are three types of buildings (commercial, residential, computer lab) along a (long) straight road. We want to place some telephone/wireless towers along the road to cover every building by at least one tower. A commercial building is covered if it is in the distance at most $r_1$ from a tower, a residential building is covered if it is in the distance at most $r_2$ from a tower, and finally, a computer lab is covered if it is in the distance at most $r_3$ from a tower. We assume that $r_3 < r_2 < r_1$. Design a strategy/algorithm that places the minimum number of towers along the road to cover every building.
Question 2. We are given an array of 2021 positive integers. Which of the following is correct? Justify your answer or give a counter-example.
⦁ If the array is sorted, then the fastest way to decide if 2021 is in the array requires 1010 operations (comparisons/assignments).
⦁ If the array is not sorted and the numbers are random, then one can sort the array with less than 20200 operations (comparisons/assignments).
⦁ Finding the 4-th smallest number in the array takes at least 22,222 operations (comparisons/assignments).
d) If the biggest number in the array is 2021, then one can sort the array by at most 4042 operations (comparisons/assignments).
Get Free Quote!
405 Experts Online