CS502 Assignment 1 Solution 2021 - Fundamental of Algorithm Assignment

 

CS502 Assignment 1 Solution Spring 2021

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


Cost

Time

C1

1

C2

n+1

C3

n

C4

n/2

C5

1


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)


MORE ASSIGNMENT SOLUTION 





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;

}

}


Cost

Time

C1

1

C2

n+1

C3

n

C4

n

C5

n+1

C6

n

C7

n(n+1)/2

C8

n2/2

C9

n2/2

C10

n

C11

n

C12

n

C13

n/2


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

CS502 Assignment 1 Solution 2021


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 

www.vuanswer.com


CS502 Assignment 1 Solution Spring 2021
CS502 Assignment 1 Solution
Download CS502 Assignment 1 Solution 2021

Post a Comment

0 Comments