Unit 4: Greedy techniques - Subjective Questions

CSE329 — Prelude To Competitive Coding • Practice Questions with Detailed Answers

20 questions

1

Define the greedy problem-solving paradigm. Explain its key characteristics and the general steps involved in designing a greedy algorithm.

2

Distinguish between a locally optimal choice and a globally optimal choice in the context of greedy algorithms. Give an example where a locally optimal choice fails to give a globally optimal solution.

3

Explain the Job Sequencing Problem with Deadlines. Describe the greedy strategy used to maximize profit and illustrate with an example.

4

Describe the Activity Selection Problem. Prove why sorting by earliest finish time yields an optimal solution.

5

Explain the Fractional Knapsack Problem and its greedy solution. How does it differ from the 0/1 Knapsack problem?

6

Describe the Connect n Ropes with Minimum Cost problem. Explain the greedy approach and why a min-heap is used.

7

Explain the Coin Change Problem using the greedy technique. Under what conditions does the greedy approach produce an optimal solution?

8

Explain how to find the Maximum Product Subset of an array. Handle all cases including negative numbers, zeros, and single elements.

9

Explain how to find the Minimum Product Subset of an array. Discuss the logic for handling negatives, positives, and zeros.

10

Describe the problem of finding the Minimum Sum of Product of Two Arrays. Prove the greedy strategy used (Rearrangement Inequality).

11

Explain the Bin Packing Problem. Describe common greedy heuristics used to solve it and comment on their approximation quality.

12

Explain the Majority Element problem and describe the Boyer-Moore Voting Algorithm used to solve it efficiently.

13

Compare the Greedy and Dynamic Programming approaches. When would you prefer one over the other?

14

Given jobs with (deadline, profit): J1(4,70), J2(1,80), J3(1,30), J4(1,100), J5(3,50), solve the Job Sequencing Problem step by step and compute maximum profit.

15

Explain the concept of optimal substructure and the greedy choice property. Why are both essential for a greedy algorithm to be correct?

16

Differentiate between the Job Sequencing Problem and the Job Selection Problem (Activity Selection). Compare their objectives and greedy criteria.

17

Solve the Fractional Knapsack problem for capacity with items: Item1(weight 6, value 30), Item2(weight 3, value 21), Item3(weight 5, value 40), Item4(weight 4, value 12). Show the value-to-weight ratios and total value.

18

Describe the greedy solution for the Connect n Ropes problem and derive its relationship with Huffman Coding.

19

Explain a greedy algorithm to solve the fractional coin/activity type problem, and discuss the limitations of greedy algorithms with two concrete examples where they fail.

20

Explain how greedy techniques are applied in competitive coding. Discuss the general problem-solving strategy and how to recognize when a problem can be solved greedily.