VU Answer Provide New CS502 Assignment 1 Solution Fall 2021. Easy to See Proper Complete CS502 Assignment 1 Solution 2021 and Download PDF File Below.

## CS502 ASSIGNMENT 1 SOLUTION FALL 2021

Provide by VU Answer

Due Date: 9 Dec 2021

Total Marks: 20

Uploading instructions

Your submission must include:

1. Assignment should be in .doc or .docx format.

2. Save your assignment with your ID (e.g. bx180200786.doc).

Question 1:

Part a)

Suppose one of the reputed higher educational institutes working on an IT based project which is related to the student management system. This project has been divided into a number of modules and different teams are working on it. One team is facing an issue in the attendance module; they cannot find the total number of students absent in a class. Total class strength is 100.

You must assist the team to write an efficient algorithm to find how many students are absent in a class.

Solution:

Step 1: Start

Step 2: Initialize variables num=1, count=0, abs

Step 3: Start roll call

Step 4: Repeat the steps until num<=100

4.1 If student present

count=count+1

4.2 num=num+1

Step 5: abs=100-count

Step 6: Display “How many students are absent:” + abs

Step 7: Stop

Part (b)

Find the Best-case and Worst-case time of the given piece of code.

Algorithm Test (n)

{

if (n <5 )

{

printf(“%d”, n);

}

else

{

for(i=0; i<n; i++)

{

printf(“%d”, i);

}

}

}

**
**

Solution:

Best case: O (1)

Worst Case: O (n)

Question 2:

Merge Sort follows divide and Conquer strategy therefore it’s a Recursive algorithm. Here is an unsorted list with eight elements.

You are required to do the following tasks:

1. Sort the above list using Merge sort in ascending order.

2. Build Merge sort tree for both divide and combine phases

Solution:

Check Also

All VU Assignment 1 Solution Fall 2021

PLEASE NOTE:

Don't copy-paste the same answer.

Make sure you can make some changes to your solution file before submitting copy-paste solution will be marked zero.

If you found any mistake then correct yourself and inform me.

Before submitting an assignment check your assignment requirement file.

If you need some help and question about files and solutions comment below.

## 0 Comments