radha gogia
Yes I really want to know why aren't we comparing algorithms on the basis of statements ,because as you said that auxiliary space is the extra space used by an algorithm ,so doesn't that mean that if an algorithm has more number of statements ,then when it will be actually implemented on the system,it would take more time for execution .
Well if you want to know why, here is an example,
see both code snippets, and tell which is faster:
int i=1;
i=i+1;
i=i+1;
i=i+2;
i=i+1;
i=i+1;
i=i+1;
cout<<i;
for(int i=0;i<1000;i++)
cout<<i;
If you said first is faster, then you are right. It has more statements (as we can see more there), but second code has more statements for the compiler (some 1000+ statements).
radha gogia
say for adding two numbers in one algorithm ,I simply display the addition of two numbers and in other algorithm ,I first store the result in another variable and then display that variable ,so in general which algorithm would execute fast,can we raise up this question or not because I guess on the real machine both algorithms will take different time for execution,so why are algorithms not compared on the basis of number of statements
but in first algo u mentioned, system will display, but while calculating, it will store the value (in its default register) as storage will happen, whether we provide or not, hence first algo will also take time.
Hope it helps.