Which of the following lines completes the above code?
arr[i] = arr[j] * arr[k];
arr[j] += arr[i] * arr[k];
arr[i] += arr[j] * arr[k].
arr[j] = arr[i] * arr[k];
Browse topic-based Data Structure And Algorithm practice sets.
302 practice sets · Page 13 of 16
Which of the following lines completes the above code?
arr[i] = arr[j] * arr[k];
arr[j] += arr[i] * arr[k];
arr[i] += arr[j] * arr[k].
arr[j] = arr[i] * arr[k];
Which of the following methods can be used to find the nth Catalan number?
Recursion
Binomial coefficients
Dynamic programming
Recursion, Binomial Coefficients, Dynamic programming
Which of the following is not an application of Catalan Numbers?
Counting the number of Dyck words
Counting the number of expressions containing n pairs of parenthesis
Counting the number of ways in which a convex polygon can be cut into triangles by connecting vertices with straight lines
Creation of head and tail for a given number of tosses
Which of the following numbers is the 6th Catalan number?
14
429
132
42
Which of the following is NOT a Catalan number?
1
5
14
43
Which of the following lines should be added to complete the code?
arr[len][len]
len + arr[len][len]
len
len - arr[len][len]
Which of the following problems can be used to solve the minimum number of insertions to form a palindrome problem?
Minimum number of jumps problem
Longest common subsequence problem
Coin change problem
Knapsack problems
Consider the string "abbccbba". What is the minimum number of insertions required to make the string a palindrome?
0
1
2
3
Consider the string "efge". What is the minimum number of insertions required to make the string a palindrome?
0
1
2
3
In the worst case, the minimum number of insertions to be made to convert the string into a palindrome is equal to the length of the string.
True
False
In which of the following cases the minimum no of insertions to form palindrome is maximum?
String of length one
String with all same characters
Palindromic string
Non palindromic string
Given a string, you have to find the minimum number of characters to be inserted in the string so that the string becomes a palindrome. Which of the following methods can be used to solve the problem?
Greedy algorithm
Recursion
Dynamic programming
Both recursion and dynamic programming
Who created the Rabin-Karp Algorithm?
Joseph Rabin and Michael Karp
Michael Rabin and Joseph Karp
Richard Karp and Michael Rabin
Michael Karp and Richard Rabin
What is the basic principle in the Rabin-Karp algorithm?
Hashing
Sorting
Augmenting
Dynamic programming
If the expected number of valid shifts is small and modulus is larger than the pattern length, what is the matching time of the Rabin-Karp Algorithm?
Theta(m)
O(n+m)
Theta(n-m)
O(n)
What happens when the modulo value (q) is taken large?
Complexity increases
Spurious hits occur frequently
Cost of extra checking is low
Matching time increases
Rabin-Karp algorithm can be used for discovering plagiarism in a sentence.
True
False
What is the worst case running time of the Rabin-Karp Algorithm?
Theta(n)
Theta(n-m)
Theta((n-m+1)m)
Theta(n log m)
What is the basic formula applied in Rabin-Karp Algorithm to achieve pre-processing in Theta(m)?
Halving rule
Horner's rule
Summation lemma
Cancellation lemma
Rabin-Karp Algorithm makes use of elementary number theoretic notions.
True
False