Professional Documents
Culture Documents
2. Explain Greedy method in detail with examples and differentiate it with a dynamic
method.
3. Discuss and derive an equation for solving the 0/1 Knapsack problem using
dynamic programming methods.
Design and analyse the algorithm for the same.
The problem statement is as follows: Given a set of items, each with a weight and a
value, determine the maximum value that can be obtained by selecting a subset of
items to fit in a knapsack with a maximum capacity without exceeding the capacity.
Each item can either be included (1) or excluded (0) from the knapsack.
Here's the equation to solve the 0/1 Knapsack problem using dynamic
programming:
Let:
The dynamic programming algorithm to solve the 0/1 Knapsack problem involves
filling in the dp table using the above equation, starting from dp[0][0] and
progressing to dp[n][W]. The value at dp[n][W] will represent the maximum value
achievable for the given problem instance.
https://www.tutorialspoint.com/design_and_analysis_of_algorithms/design_and_anal
ysis_of_algorithms_fractional_knapsack.html
5. Is Selection sorting a greedy algorithm? If so, what are the functions involved?
6. Give and Explain the Prim’s Algorithm to find out Minimum Spanning Tree with
illustration.Also give itstime complexity.
7. Give and Explain the Kruskal’s Algorithm to find out Minimum Spanning Tree with
illustration. Also give its time complexity.