Assignment Fundamental
Assignment Fundamental
1. What is meant by a priority queue? Classify its types and describe their behaviour?
2. What is meant by polynomial time solvability?
3. Sort the following array using the Selection Sort algorithm:
Given Array: [8, 4, 1, 5, 2]
4. How do Greedy algorithms differ from Dynamic Programming techniques?
5. Define reducibility in the context of NP-Completeness ?
6. Define Ω notation in asymptotic analysis and state its significance.
7. While the Bellman-Ford algorithm is useful, it has certain drawbacks. What are these
limitations ?
8. Describe how a min-heap works compared to a max-heap. How do their root
elements differ?
9. Arrange the following time complexities in ascending order:
O(n!),O(nlogn),O(1),O(n2)
10. Which two algorithms are commonly used to find the Minimum Spanning Tree (MST)
of a graph?
ii) Determine the computational complexity of the recurrence relation defined as: T(n) =
2T(n/2) + n²
Employ the recurrence tree approach to derive the asymptotic time complexity. Ensure that
all intermediary steps are demonstrated, leading toward the final asymptotic bound.
OR
b) i) Derive the solution to the recurrence relation defined as T(n) = 2T(n/2) + n by applying
the substitution method. Demonstrate a rigorous proof to validate the asymptotic bound of
the recurrence.
ii)Elaborate upon the notions of time complexity and space complexity. Highlight their
individual roles in the performance evaluation of algorithms, and articulate how they
contribute to the overall computational efficiency.
iii) Present a formal definition of Theta (Θ) notation. Discuss its theoretical significance
within the realm of algorithm analysis, especially in establishing asymptotic tight bounds ?
3. a) i) Trace the steps of Merge Sort for the array [38, 27, 43, 3, 9, 82, 10].
ii) Using the Master Theorem, solve the following recurrence relation for its time complexity:
T(n) = 3T(n/4) + n²
Provide the value of the time complexity by identifying the correct case of the Master
Theorem, and explain how the recurrence fits into that case.
iii) Explain Selection Sort with a suitable example.
OR
a) i) Construct the Huffman tree for the given character set based on their
frequencies.
Char X Y Z W V
Count 7 3 4 5 2
ii) A thief plans to fill a bag that can carry up to 15 units of weight. There are 7
valuable items available, each with a specific weight and profit.
Using the Fractional Knapsack approach, calculate the maximum profit that can be
earned by selecting whole or fractional parts of the items to completely or partially
fill the knapsack.
Objects 1 2 3 4 5 6 7
Profits 10 5 15 7 6 18 3
Weight 2 3 5 7 1 4 1
a) i) Find out the shortest path from Source A to all vertices using Dijkstra’s Algorithm.
ii) Define a Minimum Spanning Tree (MST). Explain how Prim’s algorithm and Kruskal’s
algorithm are used to construct the MST of a graph.
b)i) Given a flow network with edge capacities, a source, and a sink, use the Ford-Fulkerson
algorithm to find the maximum flow from source to sink. Show the augmenting paths and
update the residual graph after each step.
ii) Implement the Rabin-Karp Algorithm to find all occurrences of the pattern in the text.
Text: "ababcabcabc", Pattern: "abc"
b)i) Discuss the concepts of verification and reducibility in computational theory. Why are
they important when analyzing problem complexity?
ii) Define and distinguish between P, NP, and NP-Hard complexity classes ?
iii) What does it mean for an algorithm or problem to be solved in polynomial time? Provide
a clear explanation with context ?.
11. How does Breadth-First Search (BFS) differ from Depth-First Search (DFS) in graph
traversal?
12. Insertion Sort
13. What is a Priority Queue, and how does it function when handling elements with
different priorities ?
14. Sort the following array using the Heap Sort algorithm:
[4, 10, 23, 56, 1, 34]
15. Bubble Sort
16. Explain the term “algorithm” and highlight its key characteristics that make it
effective in problem-solving.
28. a)i) Solve the recurrence relation T(n)=2T(n/2)+n using the Substitution method.
ii) What is Time Complexity and What is Space Complexity.
iii) Define Theta notation and its significance.
OR
a)i) Explain the different asymptotic notations with graphs and equations.
ii) Find out the time complexity by using recurrence tree method.
T(n)=2T(n/2) +n2
29. a) i) Explain Merge Sort with an example.
ii) Derive the Worst Case time complexity of Merge sort from the recurrence relation.
OR
30.a)i) Explain Huffman coding with an example and a step-by-step tree formation.
Char A B C D E
Count 3 5 6 4 2
ii) What is a Minimum Spanning Tree (MST), and how do Prim’s and Kruskal’s algorithms find
the MST of a given graph?
31. a) i) Find out the shortest path from Source A to all vertices using Dijkstra’s Algorithm.
ii) Find out the total Profit Using Fractional Knapsack Problem.
Objects 1 2 3 4 5 6 7
Profits 10 5 15 7 6 18 3
Weight 2 3 5 7 1 4 1
32 . a) i) Find the maximum flow through the given network using Ford-Fulkerson
algorithm.
ii) Implement the Rabin-Karp Algorithm to find all occurrences of the pattern in the text.
Text: "abdbcabdcabca", Pattern: "bca"
OR