Assignment 4-Data Structure
Assignment 4-Data Structure
1. Write an algorithm for insertion sort. Apply insertion sort and show all steps
a. to sort the given 54, 95, 64, 9, 56, 73.
2. Apply Rain Terrace algorithm to the following problem.
a. Input: - Height = [4, 2, 0, 3, 2, 5]. Draw the figure and find solution
3. What is Jump Game algorithm?
4. Sort the following data using merge sort algorithm [38, 27, 43, 3, 9, 82, 10]
5. Explain Rules for Tower of Hanoi with a suitable example.
6. Consider the instance of 0/1 knapsack problem n = 3, m = 20, p = (25, 24, 15),
a. w = (18, 15, 10) using dynamic programming. Determine the optimal profit
and the solution vector.
7. Solve the following instance of 0/1 knapsack problem by applying Dynamic
programming n = 3 w = (3, 5, 7) p(3, 7, 12), M = 4
8. Find the longest common subsequence for following string using dynamic
a. programming.
b. X = {A, B, C, D, B, A, C, D, F}
c. Y = {C, B, A, F}
9. Write an algorithm of Kruskal’s algorithm.
10. Sort the following data using Mergesort [ 400, 380, 275, 750, 455, 523, 863, 355,
550, 615].
11. Consider the following array [1, 3, 5, 8, 9, 2, 6, 7, 6] what is minimum number of
jump required to reach the end of the array?
12. Give the explicit and implicit constraints in 8 queen’s problem.
13. Apply the maximum subarray algorithm to the
a. Input : arr = [–2, –5, 6, –2, –3, 1, 5, –6] and find sum of maximum subarray.
14. Write on algorithm for knight’s Tour.
15. Explain quick sort with example
Suryadatta Education Foundation’s
Suryadatta Institute of Management & Mass Communication, Pune-21
MCA Department
Subject : Data Structure
Assignment 5
Hashing
a) Explain the concept of hashing and hash table
b) Define Hash function 2 collision.
c) Explain Min Heap