You are on page 1of 4

Student ID:

Subject: CS502

Assignment: 01

Question No 01:

Part a)

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)
Solution:

Algorithm Test(n)

If(n<5)

Printf(“%d”,n);
}

Else

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

Printf(“%d”,i);

Best case : O(I)

Worst Case :O(n)

Question No 02: .

Solution:
Spli

Merge

You might also like