I: Insertion sort runs faster than merge sort if input sequences are already sorted.
II: Heap sort and selection sort time complexity will not depend on input sequence.
III. Heap sort and Quicksort are not stable algorithms
I. Primary Clustering is the tendency for a collision resolution scheme such as _______to create long runs of filled slots near the hash position of keys.
II. Secondary Clustering is the tendency for a collision resolution scheme such as _______to create long runs of filled slots away from the hash position of keys.

Insert the element 55 after constructing the max heap and Find the value of index 5 is _?
[ Hint: Index of an array starts with 0 ]
Job
|
A
|
B
|
C
|
D
|
E
|
F
|
Start Time
|
2
|
3
|
1
|
6
|
7
|
8
|
End Time
|
3
|
7
|
4
|
9
|
11
|
12
|
List-A
|
List-B
|
P: Binary Search Tree
|
1: Stack
|
Q: 0/1 knapsack problem
|
2: Greedy
|
R: Huffman Coding
|
3: Dynamic programming
|
S: Depth-first Search
|
4: Divide and Conquer
|
Find the total cost of the second best minimum Spanning tree(MST) _____?
[ Note: A second best MST is a spanning tree, that has the second minimum weight sum of all the edges, from all the possible spanning trees of the graph G ]
X = pqsprutrts
Y = qrstupqrs
A={ 20,16,1,10,13, 15, 9, 12, 11}
[ Hint: Pass is counted only when at least one swap is performed in the bubble sort pass ]
Consider two strings A = "zazrpzqrst" and B = "arzazrsatq". Let ‘X’ be the length of the longest common subsequence (not necessarily contiguous) between A and B and let ‘Y’ be the number of such longest common subsequences between A and B.
Find (5x+4y)%(x+y) = ______?
Let P be a Quicksort Program to sort numbers in ascending order using the last element as pivot. Let t1 and t2 be the number of comparisons made by P for the inputs {2, 2, 2, 2, 2} and {10, 20, 30, 40, 50} respectively. Which one of the following holds?
Consider a matrix multiplication chain ABCDE, where matrices A,B,C,D and E are of dimensions 6x7, 7x9, 9x3, 3x7 and 7x8 respectively. In the parenthesization of ABCDE that minimizes the total number of scalar multiplications. Find the correct explicit computed pairs to get the minimum number of scalar multiplications.
[ Hint: For example, in the matrix multiplication chain PQRSTU using parenthesization (P(QR))(S(TU)), QR and TU are only explicitly computed pairs ]
A B X E M S W T P N C H
E X M B S A P T N W H C
The post-order traversal of the tree is?
I) 7, 6, 5, 4, 3, 2, 1
II) 1, 2, 3, 4, 5, 6, 7
III) 4, 2, 6, 1, 3, 5, 7
IV) 4, 6, 2, 5, 3, 1, 7
for(i = 1, i< = 8; i++)
q.enqueue(i);
for ( i = 1; i<=7; i++)
{
q.dequeue();
q.enqueue(q.dequeue());
}
Assume enqueue and dequeue are circular operations for insertion and deletion respectively. The number of elements that will remain in the queue after the completion of the program is ___________
x = [1, 2, 3]
y = x
y += [4, 5]
print(x, y)
def func(a, b, c, d):
print(a, b, c, d)
a = (1, 2)
k = {'c': 3, 'd': 4}
func(*a, **k)
def generator():
yield "Hello"
yield "World"
g = generator()
print(next(g))
print(next(g))
print(next(g, "Done"))
def fun(arr):
for i in range(1, len(arr)):
arr[i] += arr[i - 1]
return arr
What does this Python function fun() do?
def fun(arr, start, end):
if start < end:
arr[start], arr[end] = arr[end], arr[start]
fun(arr, start + 1, end - 1)
What does this Python function fun() do?
def fun(arr):
def helper(l, r):
if l > r:
return 0
return max(arr[l] - helper(l + 1, r), arr[r] - helper(l, r - 1))
return helper(0, len(arr) - 1)
arr = [20, 30, 2, 2, 2, 10]
print(fun(arr))
What is the output of the above code?
def fun(n):
if n == 0:
return 0
if n % 2 == 0:
return n + fun(n - 1)
else:
return fun(n // 2)
print(fun(10))
def fun(arr, start, end):
if start >= end:
return 0
if (end - start) % 2 == 0:
return arr[end] - arr[start] + fun(arr, start + 1, end - 1)
else:
return max(fun(arr, start + 1, end), fun(arr, start, end - 1))
arr = [7, 1, 3, 4, 8, 2]
print(fun(arr, 0, len(arr) - 1))
def fun(lst):
result = []
for i in range(len(lst)):
if i % 2 == 0:
result.extend(lst[:i+1])
else:
result.extend(lst[i:])
return result
lst = [1, 2, 3, 4, 5]
print(fun(lst))
def fun(n):
result = 1
for i in range(2, n + 1):
result = (result * i) // (i % 3 + 1)
return result
n = 6
print(fun(n))
What are the possible correct output?