You are given infinite coins of denominations 1, 3, 4. What is the total number of ways in which a sum of 7 can be achieved using these coins if the order of the coins is not important?
4
3
5
6
Browse topic-based Data Structure And Algorithm practice sets.
302 practice sets · Page 11 of 16
You are given infinite coins of denominations 1, 3, 4. What is the total number of ways in which a sum of 7 can be achieved using these coins if the order of the coins is not important?
4
3
5
6
Suppose you are given infinite coins of N denominations v1, v2, v3,.....,vn and a sum S. The coin change problem is to find the minimum number of coins required to get the sum S. What is the space complexity of a dynamic programming implementation used to solve the coin change problem?
O(N)
O(S)
O(N^{2})
O(S*N)
You are given infinite coins of N denominations v1, v2, v3,.....,vn and a sum S. The coin change problem is to find the minimum number of coins required to get the sum S. What is the time complexity of a dynamic programming implementation used to solve the coin change problem?
O(N)
O(S)
O(N^{2})
O(S*N)
Suppose you have coins of denominations 1,3 and 4. You use a greedy algorithm, in which you choose the largest denomination coin which is not greater than the remaining sum. For which of the following sums, will the algorithm produce an optimal answer?
14
10
6
100
Suppose you have coins of denominations 1, 3 and 4. You use a greedy algorithm, in which you choose the largest denomination coin which is not greater than the remaining sum. For which of the following sums, will the algorithm NOT produce an optimal answer?
20
12
6
5
You are given infinite coins of denominations v1, v2, v3,.....,vn and a sum S. The coin change problem is to find the minimum number of coins required to get the sum S. This problem can be solved using ____________
Greedy algorithm
Dynamic programming
Divide and conquer
Backtracking
What is the sum of each of the balanced partitions for the array {5, 6, 7, 10, 3, 1}?
16
32
0
64
Which of the following lines should be inserted to complete the above code?
ans[i - arr[j - 1]][j - 1]
ans[i][j]
ans[i][j] || ans[i - arr[j - 1]][j - 1]
ans[i][j] && ans[i - arr[j - 1]][j - 1]
Consider a variation of the balanced partition problem in which we find two subsets such that |S1 - S2| is minimum. Consider the array {1, 2, 3, 4, 5}. Which of the following pairs of subsets is an optimal solution for the above problem?
{5, 4} & {3, 2, 1}
{5} & {4, 3, 2, 1}
{4, 2} & {5, 3, 1}
{5, 3} & {4, 2, 1}
What is the time complexity of the brute force algorithm used to solve the balanced partition problem?
O(1)
O(n)
O(n^{2})
O(2^{n})
In which of the following cases, it is not possible to have two subsets with equal sum?
When the number of elements is odd
When the number of elements is even
When the sum of elements is odd
When the sum of elements is even
Given an array, check if the array can be divided into two subsets such that the sum of elements of the two subsets is equal. This is the balanced partition problem. Which of the following methods can be used to solve the balanced partition problem?
Dynamic programming
Recursion
Brute force
Dynamic programming, Recursion, Brute force
What is the space complexity of the above dynamic programming implementation of the assembly line scheduling problem?
O(1)
O(n)
O(n^{2})
O(n^{3})
What is the time complexity of the above dynamic programming implementation of the assembly line scheduling problem?
O(1)
O(n)
O(n^{2})
O(n^{3})
Which of the following lines should be inserted to complete the above code?
(t2[i] = get_min(t2[i-1]+spent[1][i], t1[i-1]+reach[0][i-1]+spent[1][i]))
(t2[i] = get_min(t2[i-1]+spent[1][i], t1[i-1]+spent[1][i]))
(t2[i] = get_min(t2[i-1]+spent[1][i], t1[i-1]+reach[0][i-1]))
none of the mentioned
What is the minimum time required to build the car chassis?
40
41
42
43
For the optimal solution, which should be the exit assembly line?
Line 1
Line 2
All of the mentioned
None of the mentioned
For the optimal solution which should be the starting assembly line?
Line 1
Line 2
All of the mentioned
None of the mentioned
In the dynamic programming implementation of the assembly line scheduling problem, how many lookup tables are required?
0
1
2
3
What is the time complexity of the brute force algorithm used to solve the assembly line scheduling problem?
O(1)
O(n)
O(n^{2})
O(2^{n})