problem 2.1.2 from how to solve it by computer, Dromey
Posted: Sat Jul 28, 2012 7:38 pm
I am a beginner in learning algo..So please bear with me..
2.1.2 Design an algorithm that makes following exchanges of 3 varioubles..
a-->b-->c--|
^ |
^----------|
So
a_temp = a;
b_temp = b;
c_temp = c;
a=c_temp;
c=b_temp;
b=a_temp;
I know this process looks ugly. Can anyone suggest a good one so that I could learn.
2.1.2 Design an algorithm that makes following exchanges of 3 varioubles..
a-->b-->c--|
^ |
^----------|
So
a_temp = a;
b_temp = b;
c_temp = c;
a=c_temp;
c=b_temp;
b=a_temp;
I know this process looks ugly. Can anyone suggest a good one so that I could learn.