Analysis of Algorithms

¡Supera tus tareas y exámenes ahora con Quizwiz!

In a 2D array the bottom up approach is built in Cache[m+1][n+1]. The final solution was obtained by accessing which element of the cache?

Cache[m+1][n+1]

T/F: A greedy algorithm should include the following steps: find the set of candidate solutions, check if the candidate solutions are feasible, a discovery time of the shortest path a function element that finds the best unused candidate solution.

False. A discovery of the shortest path is not always true with greedy algorithms

What will be the time complexity of the coin change problem discussed in the slides using the greedy technique?

O(nlogn)

What is the running time of recusrive fib? What is the running time of an efficient DP algorithm to calculate the nth fibonacci number?

Recursive O(n^2) and DP: O(n)

The recursive activity selector -returns a max set of compatible activities for the subproblem -returns the min set of the subproblem -a nested conditional statement

The recursive activity selector returns a maximum set of compatible activities for the subproblem

The order of Insertion Sort average case is: - O(n) - Theta (n log n) - Theta (n^2) - O(n log n)

Theta (n^2)

Consider a greedy approach for solving the knapsack problem, where we first calculate the value per weight unit for each item i; i.e., vi = bi / wi , where bi denotes the benefit of item i and wi represents its weight. Then, we sort all values vi in a decreasing order, and fill the knapsack from the beginning of the sorted list. Which of the following is correct? -The approach is only for 0-1 knapsack -This approach is only efficient for fractional knapsack -This approach is efficient for both 0-1 and fractional knapsack

This approach is only efficient for fractional knapsack

The greedy-choice property is an optimal global solution that is achieved by making a locally optimal (greedy) choice

True

Which are part of the steps at each level of recursion? - divide - combine - conquer - all of the above

all of the above

The ____ notation defines an upper bound of an algorithm, it bounds a function only from above. - small omega - big omega - big O - big theta

big O

Which of the following standard algorithms is NOT dynamic programming based? - fibonacci - binary search - 0-1 knapsack problem - binomial coefficients

binary search (this is divide and conquer)

Which of the following is/are properties of a dynamic programming problem? - overlapping subproblems - optimal substructure - both optimal substructure and overlapping subproblems - greedy approach

both optimal substructure and overlapping sub-problems

Which of the two approaches start with the base case and proceed to solve the bigger sub-problems? - bottom up approach - top down approach

bottom up approach

If a problem can be solved by combining optimal solutions to non-overlapping problems, the strategy is called ____________ - iteration - dynamic programming - recursion - greedy - divide and conquer

divide and conquer

The Merge Sort uses ______ algorithm technique - greedy - dynamic programming - divide and conquer - backtracking

divide and conquer

In the merge-sort execution tree, the cost of operations done at each level of the tree is different. T/F

false

Which of the following can be used to compare two algorithms? - growth rates of two algorithms - implementations of the two algorithms - test data used to test programs which implement the two algorithms - computers on which programs which implement the two algorithms are run

growth rates of the two algorithms

Pick the statements which are true -A problem with optimal substructure can be solved with both greedy algorithm and dynamic programming algorithm -Greedy algorithms are efficient compared to dynamic programming algorithms -A greedy algorithm is sometimes hard to design -Greedy algorithms would always return an optimal solution

-A problem with optimal substructure can be solved with both greedy algorithm and dynamic programming algorithm -Greedy algorithms are efficient compared to dynamic programming algorithms -A greedy algorithm is sometimes hard to design

Which of the following growth-rate functions indicates a problem whose time requirement is independent of the problem? n n^3 log(n^2) 1

1

When using the master method, how many cases are required to memorize for the ability to easily determine the asymptotic bounds for many simple recurrences?

3

Given the recurrence f(n) = 4 f(n/2) + 1, how many sub-problems will a divide and conquer algorithm divide the original problem into and what will be the size of those sub-problems?

4 sub-problems and each the size of n/2

Which of the following greedy strategies results in the LEAST optimal for the activity selection problem? -Earliest finish time -Earliest start time -Latest start time -Latest finish time

Earliest start time and latest finish time

Algorithm efficiency is typically a concern for _________ - problems of all sizes - large problems only - medium sized problems only - small problems only

large problems only

In dynamic programming, the technique of storing the previously calculated values is called _________ - mapping - saving value property - storing value property - memoization

memoization

Which of the following growth-rate functions grow the fastest in value? n 1 log n n^2

n^2

If a dynamic programming algorithm uses an nxn table then the running time is always

not enough information to determine

An algorithm's execution time is related to the number of ________ it requires. test data sets data fields operations parameters

operations

What methods does the textbook present for solving recurrences by guessing a bound and using mathematical induction to prove accuracy? - the master method - the iterative functions method - the recursion tree method - the substitution method

the substitution method


Conjuntos de estudio relacionados

Precalculus Solving for x using inverse trig functions

View Set

S66 FSA: Investment Advisers Act of 1940

View Set

Entrep: Chapter 4 Business Plan - Identifying Opportunities

View Set

Module 22: Studying and Encoding Memories

View Set