CS502 Assignment No 01 Solution Due Date : 16-11-2017

By | November 16, 2017
(Last Updated On: November 16, 2017)

cs502 assignment

CS502 Assignment 1 Complete Solution 2017

 

 

CS502 Assignment No 01 Solution Fall 2017

 

Question # 1:                                                                                  10 Marks

For the following code snippet, provide line-by-line analysis and construct function T(n) that give the runtime of this code snippet as a function of “n”. Also determine the big-Oh of Best-case, Worst-case and Average case for this code snippet.   [Marks: 4+2+2+2]

Search(A, Key)

i  ← 1

while (A[i] ≠ key) and (i ≤ length[A])

i ← i + 1

if ( i ≤ length[A])

return true

else

return false

 

Question # 2:                                                                                 

Find the 19th smallest element from the array given below using Selection Algorithm (Sieve Technique); you are required to provide complete procedure along with array indexing and their values at each step.

933, 782, 116, 276, 904, 353, 416, 157, 277, 583, 525, 208, 269, 98, 181, 859, 573, 225, 526, 627, 631, 590, 257, 402, 335

Note: pivot must be the last element of the array in each iteration (i.e. q = r)

 

You can download the CS502 Fundamentals of Algorithms Assignment 1 Solution file from here

 

Download Assignment

2 thoughts on “CS502 Assignment No 01 Solution Due Date : 16-11-2017

  1. Tahir

    Thank you sir, if your assignment gives me 70 % of marks i’ll pay for it. and the same i’ll write to you before the new assignment starts so that you can make it for me.

Comments are closed.