CS502 Assignment 1 Solution 2021. We Provided you CS502 Assignment 1 Solution 2021. Fundamental of Algorithm Assignment.
Check Here
Latest New CS502 Assignment 1 Solution FALL 2021
CS502 ASSIGNMENT 1 SOLUTION SPRING 2021
Provided by VU Answer
Total Marks: 20
Question No 1
SOLUTION:
Part A.
Pseudo Code:
arraylist ()
for i=1 to no of accounts
if amount < 1000$
arraylist (account_no)
return false
Part B.
Time Complexity
Grand Total = c1+c2(n+1)+c3(n)+c4(n/2)+c5
= c1+c2n+c2+c3n+c4n/2+c5
= n(c2+c3+c4(1/2))+c1+c2+c5
= remove lowest order terms & constant
= O(n)
Question No 02
SOLUTION:
int arr[5], j, x , y, z;
for(x=0; x<5; x++)
{
cout<<"Enter the no."<<endl;
cin>>arr[x];
}
for(x=0;x<5;x++)
{
y=0;
for(j=2; j<arr[x];j++)
{
z=arr[x]%j;
if(z==0)
{
y=1;
break;
}
}
if(y==0)
cout<<arr[x]<<endl;
}
}
Grand Total = c1+c2n+c2+c3n+c4n+c5n+c5+c6n+c7n2/2+c7n/2+c8n2/2+c9n2/2+c10n+c11n+c12n+c13n/2
O(n2)
CLICK TO DOWNLOAD SOLUTION FILE BELOW
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.
MORE ANY ASSIGNMENTS SOLUTION FREE
0 Comments