Cs502 Assignment 2 Solution Spring 2021

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

CS502- Design and Analysis of Algorithms

Assignment no 2

BC190301751

Question no 1

Sort the following list using Merge Sort in ascending order.


"K, N, L, D, S, D, Q, R"
It is required to draw tree structure of the merge sort procedure for both divide and combine
phase separately.

Solution:-

K, N, L, D, S, D, Q, R

K, N, L, D S, D, Q, R

S, D Q, R
K, N L, D

D, D, K, L, N, Q , R, S

D, K, L, N D, Q, R, S

K,N D,L D ,S Q,R


Question No 2:-

For the given array, draw the final Max-Heap structure. Show a final single three only.
Steps are not required.

43 12 23 2 55 11 7 33 60 32

Solution:-

60

55 23

43
32

11
7

2
33
12

You might also like