GATE Computer ScienceHardGATE CSE · UGC NET
Six matrices have dimensions given by the sequence 5, 10, 3, 12, 5, 50, 6 (matrix i is p[i-1] × p[i]). The minimum number of scalar multiplications needed for the full product is
- A. 3380
- B. 2010
- C. 2340
- D. 1530
Correct answer: B. 2010
Matrix-chain DP gives m[1][6] = 2010; multiplying strictly left to right costs 3380.
More Algorithms questions
- A binary counter starts at 0 and is incremented 1000 times. The cost of an increment is the number of bits that flip. What is the total…
- Unit-time jobs with (deadline, profit): (2,100), (1,19), (2,27), (1,25), (3,15), (3,90), (4,60), (5,10). Each job takes one slot and must…
- Keys 22, 33, 44, 12, 23, 34, 45, 1 are inserted in this order into a table of size 11 using h(k) = k mod 11 with linear probing. Counting…
- A DAG on vertices 0..5 has edges 0→2, 1→2, 1→3, 2→4, 3→4, 3→5, 4→5. How many distinct topological orderings does it have?
- A binary search (loop while low ≤ high, mid = ⌊(low+high)/2⌋) runs on a sorted array of 1000 elements. The maximum number of loop…
- Keys 1..7 are inserted into an initially empty BST (no balancing) in some order. For how many of the 7! insertion orders does the…