If an optimal solution can be created for a problem by constructing optimal solutions for its subproblems, the problem possesses ____________ property.
Overlapping subproblems
Optimal substructure
Memoization
Greedy
Browse topic-based Data Structure And Algorithm practice sets.
302 practice sets · Page 10 of 16
If an optimal solution can be created for a problem by constructing optimal solutions for its subproblems, the problem possesses ____________ property.
Overlapping subproblems
Optimal substructure
Memoization
Greedy
Which of the following is/are property/properties of a dynamic programming problem?
Optimal substructure
Overlapping subproblems
Greedy approach
Both optimal substructure and overlapping subproblems
Which of the following lines should be added to complete the above code?
arr[num_of_dice][S]
arr[dice][sm]
arr[dice][S]
arr[S][dice]
There are 10 dice having 5 faces. The faces are numbered from 1 to 5. What is the number of ways in which a sum of 4 can be achieved?
0
2
4
8
There are n dice with f faces. The faces are numbered from 1 to f. What is the maximum possible sum that can be obtained when the n dice are rolled together?
1
f*f
n*n
n*f
There are n dice with f faces. The faces are numbered from 1 to f. What is the minimum possible sum that can be obtained when the n dice are rolled together?
1
f
n
n*f
You have 2 dice each of them having 6 faces numbered from 1 to 6. What is the number of ways in which a sum of 11 can be achieved?
0
1
2
3
You have 3 dice each having 6 faces. What is the number of permutations that can be obtained when you roll the 3 dice together?
27
36
216
81
You have n dice each having f faces. What is the number of permutations that can be obtained when you roll the n dice together?
nnn...f times
fff...n times
nnn...n times
fff...f times
You are given n dice each having f faces. You have to find the number of ways in which a sum of S can be achieved. This is the dice throw problem. Which of the following methods can be used to solve the dice throw problem?
Brute force
Recursion
Dynamic programming
Brute force, Recursion and Dynamic Programming
Which of the following lines should be added to complete the "if(op[pos] == '|')" part of the code?
False[row][col] += True[row][pos] * False[pos+1][col]; True[row][col] += t_row_pos * t_pos_col + False[row][pos] * False[pos+1][col];
False[row][col] += False[row][pos] * True[pos+1][col]; True[row][col] += t_row_pos * t_pos_col - True[row][pos] * True[pos+1][col];
False[row][col] += True[row][pos] * True[pos+1][col]; True[row][col] += t_row_pos * t_pos_col + True[row][pos] * True[pos+1][col];
False[row][col] += False[row][pos] * False[pos+1][col]; True[row][col] += t_row_pos * t_pos_col - False[row][pos] * False[pos+1][col];
What is the maximum number of ways in which a boolean expression with n + 1 terms can be parenthesized, such that the output is true?
nth catalan number
n factorial
n cube
n square
Which of the following gives the total number of ways of parenthesizing an expression with n + 1 terms?
n factorial
n square
n cube
nth catalan number
Consider the expression T | F ∧ T. In how many ways can the expression be parenthesized so that the output is F (false)?
0
1
2
3
Consider the expression T & F ∧ T. What is the number of ways in which the expression can be parenthesized so that the output is T (true)?
0
1
2
3
Consider the expression T & F | T. What is the number of ways in which the expression can be parenthesized so that the output is T (true)?
0
1
2
3
You are given a boolean expression which consists of operators &, | and ∧ (AND, OR and XOR) and symbols T or F (true or false). You have to find the number of ways in which the symbols can be parenthesized so that the expression evaluates to true. This is the boolean parenthesization problem. Which of the following methods can be used to solve the problem?
Dynamic programming
Recursion
Brute force
Dynamic programming, Recursion and Brute force
You are given infinite coins of denominations 3, 5, 7. Which of the following sum CANNOT be achieved using these coins?
15
16
17
4
You are given infinite coins of denominations 5, 7, 9. Which of the following sum CANNOT be achieved using these coins?
50
21
13
23
You are given infinite coins of denominations 1, 3, 4. What is the minimum number of coins required to achieve a sum of 7?
1
2
3
4