Sorry, I thought populatetest was part of the solution. I havent run
your code, but it seems not correct and have you tested it before you
posted here?

in your populatetest

a=++cnt;

doesnt it change a[0] only?

I am pretty amazed if you can do constant space. Can you explain your
algo?


On Mar 25, 2:58 pm, "Karthik Singaram L" <[EMAIL PROTECTED]>
wrote:
> for(i=1; i<=n; i++) {
> p= calc_m1(i)*calc_m2(i) + calc_m1(i)/2;
> if((p<i && a[p]<a)|| (p>i && a[p]>a))
> continue;
> j=i;
> while(p!=i)
> {
> temp = a[j];
> a[j] = a[p];
> a[p] = temp;
> p = calc_m1(p)*calc_m2(p) + calc_m1(p)/2;
>
> }
> }
>
> Isnt this constant space (assuming that the array a is given already).
> Since calc_m1 and calc_m2 are non recursive?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to