find the element nearest to zero.make it pivot element.then apply one pass of quicksort over the array.this is O(n) On Thu, Jun 21, 2012 at 12:27 AM, Akshat Sapra <sapraaks...@gmail.com>wrote:
> void make_group( int a[], int size) { > int j = 0; > > for ( int i = 0; i < size; i++ ) { > if ( a[i] < 0 ) { > swap(a[i],a[j]); > j++; > } > } > } > > > -- > > > Akshat Sapra > Under Graduation(B.Tech) > IIIT-Allahabad(Amethi Campus) > *--------------------------------------* > sapraaks...@gmail.com > akshatsapr...@gmail.com > rit20009008@ <rit20009...@gmail.com>iiita.ac.in > > -- > 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. > -- Abhishek Sharma Under-Graduate Student, PEC University of Technology -- 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.