Consider these two functions and two statements S1 and S2 about them.

int work1(int *a,int i,int j)
{
int x=a[i+2];
a[j]=x+1;
return a[i+2]-3;
}


int work2(int *a,int i,int j)
{
int t1=i+2;
int t2=a[t1];
a[j]=t2+1;
return t2-3;
}


S1)The transformation from work1 to work2 is valid, i.e.,for any
program state and input arguments, work2 will compute the same output
and have the same effect on program state as work1.

S2)All the transformations applied to work1 to get work2 will always
improve the performance (i.e., reduce CPU time) of work2 compared to
work1.

A)S1 is false and S2 is false

B)S1 is false and S2 is true

C)S1 is true and S2 is false

A)S1 is true and S2 is true


Plz Explain me in detail.......

Vijay................

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to