Ch 1 Big 0, Timing Complexity

studied byStudied by 0 people
0.0(0)
learn
LearnA personalized and smart learning plan
exam
Practice TestTake a test on your terms and definitions
spaced repetition
Spaced RepetitionScientifically backed study method
heart puzzle
Matching GameHow quick can you match all your cards?
flashcards
FlashcardsStudy terms and definitions

1 / 12

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

13 Terms

1

18.1  Estimating algorithm efficiency is ________

A. to measure their actual execution time.

B. to estimate their execution time.

C. to estimate their growth function.

C

New cards
2

18.3  Why is the analysis often for the worst case?

A. Best-case is not representative.

B. Worst-case is not representative, but worst-case analysis is very useful. You can show that the algorithm will never be slower than the worst-case.

C. Average-case analysis is ideal, but difficult to perform, because it is hard to determine the relative probabilities and distributions of various input instances for many problems.

A B and C

New cards
3

18.4  Which of the following complexity is O(nlogn)

A. 300n + 400n*n

B. 23nlogn + 50

C. 45n + 45nlogn + 503

D. n*n*n + nlogn

B and C

New cards
4

18.6  What is the number of iterations in the following loop:

 int count = 5;
 while (count < n) {
   count = count + 3;
 }

A. n - 5

B. n - 3

C. n / 3 - 1

D. (n - 5) / 3

E. the ceiling of (n - 5) / 3

E

New cards
5

18.10  The time complexity for the selection sort algorithm in the text is ________.

A. O(nlogn)

B. O(n^2)

C. O(logn)

D. O(2^n)

B

New cards
6

18.11  The time complexity for the insertion sort algorithm in the text is ________.

A. O(nlogn)

B. O(n^2)

C. O(logn)

D. O(2^n)

B

New cards
7

18.12  ______________ approach is the process of solving subproblems, then combining the solutions of the subproblems to obtain an overall solution. This naturally leads to a recursive solution. However, it would be inefficient to use recursion, because the subproblems overlap. The key idea behind dynamic programming is to solve each subproblem only once and store the results for subproblems for later use to avoid redundant computing of the subproblems.

A. Divide-and-conqure

B. Dynamic programming

C. Brutal-force

D. Backtracking

B

New cards
8

18.13  The time complexity for the recursive Fibnacci algorithm in the text is ________.

A. O(nlogn)

B. O(n^2)

C. O(logn)

D. O(2^n)

D

New cards
9

18.15  The time complexity for the Euclid?s algorithm is ________.

A. O(n)

B. O(n^2)

C. O(logn)

D. O(2^n)

C

New cards
10

18.17  The time complexity for the the closest pair of points problem using divide-and-conquer is ________.

A. O(n)

B. O(nlogn)

C. O(logn)

C. O(logn)

B

New cards
11

18.18  ______________ approach divides the problem into subproblems, solves the subproblems, then combines the solutions of the subproblems to obtain the solution for the entire problem. Unlike the ________ approach, the subproblems in the divide-and-conquer approach don?t overlap. A subproblem is like the original problem with a smaller size, so you can apply recursion to solve the problem.

A. Divide-and-conqure/dynamic programming

B. Dynamic programming/divide-and-conqure

C. Brutal-force/divide-and-conqure

D. Backtracking/dynamic programming

A

New cards
12

18.20  The gift-wrapping algorithm for finding a convex hull takes ______________ time.

A. O(n)

B. O(nlogn)

C. O(logn)

D. O(n^2)

D

New cards
13

18.21  The Graham's algorithm for finding a convex hull takes ______________ time.

A. O(n)

B. O(nlogn)

C. O(logn)

D. O(n^2)

B

New cards

Explore top notes

note Note
studied byStudied by 1062 people
705 days ago
4.8(4)
note Note
studied byStudied by 4 people
58 days ago
5.0(3)
note Note
studied byStudied by 20 people
775 days ago
5.0(1)
note Note
studied byStudied by 47 people
834 days ago
5.0(1)
note Note
studied byStudied by 12 people
833 days ago
5.0(1)
note Note
studied byStudied by 45 people
818 days ago
5.0(1)
note Note
studied byStudied by 5 people
654 days ago
5.0(1)
note Note
studied byStudied by 67 people
420 days ago
5.0(1)

Explore top flashcards

flashcards Flashcard (106)
studied byStudied by 1 person
714 days ago
5.0(1)
flashcards Flashcard (31)
studied byStudied by 4 people
91 days ago
5.0(1)
flashcards Flashcard (74)
studied byStudied by 16 people
841 days ago
5.0(2)
flashcards Flashcard (167)
studied byStudied by 6 people
393 days ago
5.0(1)
flashcards Flashcard (81)
studied byStudied by 272 people
468 days ago
4.5(2)
flashcards Flashcard (37)
studied byStudied by 173 people
841 days ago
5.0(1)
flashcards Flashcard (36)
studied byStudied by 10 people
91 days ago
5.0(1)
flashcards Flashcard (62)
studied byStudied by 14 people
42 days ago
5.0(1)
robot