CS201 MID TERM SOLVED MCQs || PAST PAPERS || GROUP-1 || INTRODUCTION TO PROGRAMMING || VuTech Visit Website For More Solutions www.vutechofficial.blogspot.com …
Suppose one of the reputed higher educational institute 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.
Step 6: Display “How many students are
absents: “ + 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);
}
}
}
Answer:
Best-Case: O (1)
Worst-Case: O (n)
KINDLY, DON’T COPY PASTE
Visit Website For More Solutions
www.vutechofficial.blogspot.com
Question No. 2
Merge Sort follows divide and Conquer strategy therefore it’s a Recursive
algorithm. Here is an unsorted list with eight elements.
8
3
7
5
9
2
6
4
1 - Sort the above list using Merge sort in ascending order.
2 - Build Merge sort tree for both divide and combine phases.
You are required to do the following tasks:
Answer:
8
3
7
5
9
2
6
4
KINDLY, DON’T COPY PASTE SUBSCRIBE, SHARE, LIKE AND COMMENTS FOR MORE UPDATES SEND WHATSAPP OR E-MAIL FOR ANY QUERY 0325-6644800 kamranhameedvu@gmail.com Visit Website For More Solutions www.vutechofficial.blogspot.com
We provide Virtual University of Pakistan Study Materials such as Solution of Assignments, GDBs, Mid Term Solved Papers, Final Term Solved Papers, Mid Term Solved MCQs, and Final Term Solved MCQs. We also provide regular Semester Quizzes, Updated Handouts, and Short Questions and Answers. We help you with your research and many other educational-related topics, as far as we know. Furthermore, Share your problem with us and Please feel free to ask any related questions.