Consider the below function for selection sort algorithm.
Assume that the list L=[25, 17, 20, 10, 15] is passed to the function selectionsort() as parameter. What will
be the list L after the second pass of selection sort?
A.
[10, 15, 20, 25, 17]
B.
[10, 25, 20, 17, 15]
C.
[10, 15, 25, 20, 17]
D.
[25, 17, 20, 10, 15]
A published solution is not available for this question yet.
Consider an implementation of a linked list where each node is created using the given class Node.
Suppose head points to the first node of the linked list. Assume that the linked list is in **sorted**
**order**.
What is an efficient way to count duplicate values in the linked list?
A.
Traverse the linked list once, comparing each node with its immediate
successor and count duplicates.
B.
Traverse the linked list once and store each node’s value in a hash table to
count duplicates.
C.
Use a nested loop to compare each node with all other nodes and count
duplicates.
D.
Recursively traverse the linked list from the tail and count duplicates.
A published solution is not available for this question yet.
Let G be a complete undirected graph on 4 vertices, having 6 edges with weights being 2, 5, 7, 9, 12,
14. The maximum possible total weight that a minimum weight spanning tree of G can have is __.
A published solution is not available for this question yet.
The weighted path length (WPL) of a Huffman tree over an alphabet A is defined as:
1.
2. Where the depth is the number of edges from the root to the letter
If a Huffman code is constructed for text with frequencies {1, 1, 2, 3, 5, 8}, what is the total weighted
path length of the tree?
A published solution is not available for this question yet.
For which of the following coin denominations does the Greedy strategy of choosing the largest coin
that does not exceed the target fail to produce the minimum number of coins to make the amount
8?
A.
{1, 4, 6}
B.
{1, 3, 4}
C.
{1, 5, 7}
D.
{1, 2, 6}
A published solution is not available for this question yet.
What median value will be returned by the given MoM function for the following list?
[1, 3, 7, 4, 3, 2, 7, 9, 15, 12, 19, 25, 16, 17, 11, 17, 21, 28, 18, 30]
A published solution is not available for this question yet.
Consider the function mystery() that takes strings X and Y as input. What will mystery('ABCDFGH','ACDFHBG')
return? LCS(X,Y) returns the length of the longest common subsequence of X and Y.
A.
10
B.
9
C.
8
D.
7
A published solution is not available for this question yet.
A factory produces two types of toys: Toy A and Toy B. The profit is Rs 4 for Toy A and Rs 3 for Toy
B.
• Each Toy A takes twice the machine time of Toy B. If the factory only made Toy B, it could
produce 1200 units per day.
• The total daily availability of plastic is sufficient to produce 600 toys in total.
• Each Toy A needs a special chip, and only 250 chips are available daily.
• Each Toy B needs a spring, and only 400 springs are available daily.
Let
and
be the number of Toy A and Toy B manufactured each day. Which of the following is
**not a valid** constraint for the Linear Programming formulation?
A.B.C.D.
A published solution is not available for this question yet.