@ Ruturaj: Your Problem's Solution...... :) public class Sorting { public static void main(String arg[]) { int[] a = {2,4,5,1,7,3}; a = checkNumber(0,1,a);
// to Print an Array for(int k=0;k<a.length;k++) System.out.println(a[k]); } public static int[] checkNumber(int i,int j,int[] a) { int temp; if(a[i]>a[j]) { temp = a[i]; a[i] = a[j]; a[j] = temp; } if(++j<a.length) return checkNumber(i,j,a); else if(++i<a.length-1) return checkNumber(i,i++,a); else return a; } } On Mar 6, 8:52 pm, Ruturaj <rutura...@gmail.com> wrote: > Using GOTO and loops it the same, cause loops are expanded to GOTO/JMP > statements. > Doing it just with recursion is interesting. > > Try sorting number without using loops or goto. > Here is the complete problem. > Take in n numbers as input and sort them, without using dowhile, > while, for or goto. No hash defines either. > Try to write the shortest such code. short in character count. > > You can get a very nice solution.. > will post the answer in 24 hrs.. try till then \o/ > > On Mar 1, 4:47 pm, gaurav gupta <1989.gau...@googlemail.com> wrote: > > > @bittu > > > please read the thread carefully. It was mentioned not to use GOTO > > statement. > > > On Tue, Mar 1, 2011 at 5:13 PM, bittu <shashank7andr...@gmail.com> wrote: > > > here we go > > > > void main() > > > { > > > int i; > > > > i=1; > > > > loop: > > > printf("%d", i) > > > (i<100)? i++: return 0; > > > go to loop; > > > > } > > > > Thanks & Regards > > > Shashank Mani >> "The Best Way to Escape From The Problem is to Solve > > > it" > > > > -- > > > 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 > > > algogeeks+unsubscr...@googlegroups.com. > > > For more options, visit this group at > > >http://groups.google.com/group/algogeeks?hl=en. > > > -- > > Thanks & Regards, > > Gaurav Gupta > > 7676-999-350 > > > "Quality is never an accident. It is always result of intelligent effort" - > > John Ruskin -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.