Module 5

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Consider the problem of finding the closest pair of points in a set of points in the 2d plane. We designed a divide-and-conquer algorithm that solves the problem. In each step of the algorithm we have identified a closest pair within the subsets, with a smallest distance δ. We now need to find the closest pair consisting of points from different subsets. In order to find the pair in linear time, the search can be restricted to a smaller set. How was this done?

All candidates must lie within distance δ from the line that separates the subsets.

Which one of the following is not a characteristic of mergesort?

Any sorted list is a base case.

Consider a divide-and-conquer algorithm implemented by a recursive function. The recursive function makes two recursive calls to instances half the size. The cost of divide and combine is quadratic. Which one of the following best describes the running time of the algorithm?

O(n^2)

Consider the problem of counting the inversions in a list of length n. What is the running time of the brute force algorithm that solves the problem?

O(n^2)

Consider the problem of counting the number of inversions. We designed a divide and conquer algorithm that solved the problem. What was the challenge in the process of designing the algorithm?

Finding the number of inversions between different sublists in linear time.

Consider a divide-and-conquer algorithm implemented by a recursive function. The running time of the algorithm satisfies the recurrence relation T(n) ≤ q · T(n/2) + cn, for n ≥ 2 T(2) ≤ c Which one of the following best describes the maximum depth of the recursion of the algorithm?

O(log n)

Consider T(n), the worst-case running time of mergesort. What is the recurrence relation that T(n) satisfyes?

T(n) ≤ 2T(n/2) + cn, for some constant c and n ≥ 2 T(2) ≤ 2

Consider a divide-and-conquer algorithm implemented by a recursive function. The running time of the algorithm satisfies the recurrence relation T(n) ≤ q · T(n/2) + cn, for n ≥ 2 T(2) ≤ c What is a correct interpretation of the parameter q?

q is the number of recursive calls that will be made in the recursive function

Consider a divide-and-conquer algorithm implemented by a recursive function. The running time of the algorithm satisfies the recurrence relation T(n) ≤ q · T(n/2) + cn, for n ≥ 2 T(2) ≤ c Which one of the following best describes the running time of the algorithm?

O(n^log q)

Consider the problem of counting the number of inversions in a list. What is the running time of the divide and conquer algorithm that solves the problem?

O(nlogn)

What is the best-case running time of mergesort?

O(nlogn)

Consider a divide-and-conquer algorithm implemented by a recursive function. The running time of the algorithm satisfies the recurrence relation T(n) ≤ T(n/2) + cn, for n ≥ 2 T(2) ≤ c Which one of the following statements regarding the algorithm is not true?

One algorithm that is described by this recurrence relation is binary search.

Consider the problem of counting the number of inversions in a list. We designed a divide-and-conquer algorithm based on mergesort. The algorithm divides the list into two sublists and solves the problem recursively. How were the inversions within the sublists handled?

Inversions within the same sublist are handled by the recursive calls.

Consider the problem of finding the closest pair of points in a set of points in the 2d plane. Which one of the following best describes the running time of the divide-and-conquer algorithm that solves the problem?

O(n log n)

Consider a divide-and-conquer algorithm implemented by a recursive function. The running time of the algorithm satisfies the recurrence relation T(n) ≤ T(n/2) + cn, for n ≥ 2 T(2) ≤ c Which one of the following best describes the running time of the algorithm?

O(n)

Consider the problem of finding the closest pair of points in a set of points in the 2d plane. We are designing a divide-and-conquer algorithm that solves the problem in O(n log n) time. In each step of the algorithm, we would like to consider the points sorted by x and y coordinates. Which one of the following statements is true regarding sorting as part of the algorithm?

The algorithm has the same running time as the sorting, so we can sort the points at most a constant number of times without affecting the asymptotic running time.

Consider a divide-and-conquer algorithm implemented by a recursive function. The running time of the algorithm satisfies the recurrence relation T(n) ≤ 3 · T(n/2) + cn, for n ≥ 2 T(2) ≤ c Which one of the following statements regarding the algorithm is not true?

The cost for an arbitrary level of recursion k is constant.

The running time of a divide and conquer algorithm satisfies a recurrence relation. What does solving the recurrence relation refer to?

Finding an explicit bound for the running time

Consider the problem of finding the closest pair of points in the 2d plane. We designed a divide-and-conquer algorithm that solved the problem. What was the challenge in the process of designing the algorithm?

Finding the closest pair of points for points in different subsets in linear time.

Consider the problem of finding the closest pair of points in a set of points in the 2d plane. We designed a divide-and-conquer algorithm that solves the problem. In each step of the algorithm we have identified a closest pair within the subsets, with a smallest distance δ. We now need to find the closest pair consisting of points from different subsets. In order to find the pair in linear time, the search was restricted to a smaller set S. How did we achieve linear running time when searching for the closest pair of points in S?

We showed that the two points having the smallest distance from each other can be at most a constant number of positions apart when the points in S are considered by increasing y-coordinate.


Set pelajaran terkait

Microbiology 250 - Chapter #4 Self Quiz

View Set

English 2327 The Legend of Sleepy Hollow

View Set

NCLEX Hurst Adult/Maternity/Psy/Priority/Child/Fundamental Questions

View Set

mod 4 data collection, behavior/ decisions

View Set