www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More

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: 10 Marks

Find the 19thsmallest 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)


+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)


Views: 9417

Attachments:

Replies to This Discussion

thanks bro or han yi array ki form main likhna hay

you can write it vertically or in horizontally. in array form or in boxes whatever what you feel easy you can do.

tou q.1?

uski abi smj ni a rhi ma try kr rha solve krne ki.
i'll share if done.

thanks _dastgeer

correct solution of cs502

Attachments:

itni mushkil hai kch pta nai chal raha question 1 k bary mein

Search(A, Key)

i←1

1 access

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

n times

i←i+1

 1 access

if ( i ≤ length[A])

n times

return true

1 access

else

return false

1 access

T(search) = 1+ 2(n+1)+1+1

             =5+2n

so Big O notation will be O(n)

bhai ye solution hai kiya????

check it...

Attachments:

thanks Naveed Qureshi

Naveed bhai es mai se kon sa solutoin thk ha? apka ya aysha ka?

RSS

Looking For Something? Search Below

Latest Activity

≋M≋S≋ replied to + !! Ήලᵯᵯℹ Ⲥⱨ !! +'s discussion !!!! exactely!!!!
11 minutes ago
≋M≋S≋ posted a discussion
16 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion BIO201 Assignment No 02 Fall 2020 Solution / Discussion Due Date: 25-01-2021 in the group BIO201 Basic Cell Biology
19 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion BIO201 Assignment No 02 Fall 2020 Solution / Discussion Due Date: 25-01-2021 in the group BIO201 Basic Cell Biology
19 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion BIO201 Assignment No 02 Fall 2020 Solution / Discussion Due Date: 25-01-2021
20 minutes ago
≋M≋S≋ liked + !! Ήලᵯᵯℹ Ⲥⱨ !! +'s discussion !!!! bilkul!!!!
21 minutes ago
+ M.Tariq Malik added a discussion to the group BIO201 Basic Cell Biology
21 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MGT101 Financial Accounting Assignment 01 Fall 2020 Solution / Discussion in the group MGT101 Financial Accounting
27 minutes ago
+ !! Ήලᵯᵯℹ Ⲥⱨ !! + replied to + !! Ήලᵯᵯℹ Ⲥⱨ !! +'s discussion !!!! exactely!!!!
31 minutes ago
ZoHaiB_RaJPuT liked + !! Ήලᵯᵯℹ Ⲥⱨ !! +'s discussion !!!! exactely!!!!
1 hour ago
ZoHaiB_RaJPuT replied to + !! Ήලᵯᵯℹ Ⲥⱨ !! +'s discussion !!!! exactely!!!!
1 hour ago
+ !! Ήලᵯᵯℹ Ⲥⱨ !! + replied to + !! Ήලᵯᵯℹ Ⲥⱨ !! +'s discussion !!!! exactely!!!!
1 hour ago

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.