0% found this document useful (0 votes)
84 views2 pages

Algorithms and Problems in Computer Science

The document covers various algorithmic concepts including the Knapsack problem, Stack implementation, Greedy vs Dynamic Programming approaches, and complexities of sorting algorithms. It also discusses graph algorithms like Dijkstra's and techniques such as Branch and Bound, backtracking, and Divide and Conquer. Additionally, it addresses NP-hard problems, Cook's theorem, and the relationships between P, NP, NP-hard, and NP-complete classes.

Uploaded by

n.s.lodhi414
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views2 pages

Algorithms and Problems in Computer Science

The document covers various algorithmic concepts including the Knapsack problem, Stack implementation, Greedy vs Dynamic Programming approaches, and complexities of sorting algorithms. It also discusses graph algorithms like Dijkstra's and techniques such as Branch and Bound, backtracking, and Divide and Conquer. Additionally, it addresses NP-hard problems, Cook's theorem, and the relationships between P, NP, NP-hard, and NP-complete classes.

Uploaded by

n.s.lodhi414
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1. What is Knapsack problem? Write algorithm for Greedy approach to solve Knapsack.

Splve the following


knapsack problem using greedy approach: P(P1, P2,…,P5)= 15,12,9,16,17 and W= 2,5,3,4,6 where m=12.
2. What is a Stack? How it is implemented using array?
3. Differentiate between Greedy and Dynamic Programming approach.
4. Derive complexity of quick sort.
5. Write applications of Branch and Bound Techniques.
6. Explain backtracking approach in short.
7. Define disjoint sets and its two operations.
8. Write the pseudo code for Divide and Conquer approach.
9. Explain asymptotic notations? Give their mathematical models.
10. Apply DAC on the algorithm of Binary Search and deduce its complexity.

11. Solve the following using DIJKSTRA algorithm. Source is 0.

12.

State Travelling Salesman Problem. Solve following TSP using dynamic programming

13.
[ ]
0 5 7 8
2 0 3 5
14.
8 9 0 10
12 13 11 0

15. State and explain the 8-Queens problem. Write its algorithm and draw its state space tree for
solution.

16. Draw the portion of the state space tree generated by LCBB for the portion of the knapsack : n=5,
(p1,p2,..,p5)= (10,15,6,8,4), (w1,w2,..,w5)= (4,6,3,4,2) and m=12
17. Deduce the complexity of merge sort with the help of an algorithm
18. What is graph coloring? How backtracking is used for graph coloring problem. Explain with state
space tree with an example.
19. Let w=(5,7,10,12,15,18,20) and m=35. Find all possible subsets of w that sum to m. Draw the
portion of the state space tree that is generated.
20. Compute a minimum cost spanning tree for the below graph using 1) Prim’s algorithm 2) Kruskal’s
algorithm

21.
22. Apply Branch and Bound technique and solve the following TSP.

[ ]
∞ 20 30 10 11
15 ∞ 16 4 2
23. 3 5 ∞ 2 4
19 6 18 ∞ 3
16 4 7 16 ∞

24. State and prove cook’s theorem.


25. Explain NP-hard graph problems. State and prove that CDP is NP-hard.

26. What is the relationship between P,NP, NP-hard and NP-complete. Show with diagrams. Also
differentiate between P and NP, NP-hard and NP-complete.

You might also like