|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| Quicksort |
|
![]() Anonymous Poster |
||||
|
||||
| This was EXTREMLY helpful but still I cannot get my QuickSort Function to work Could some experienced programmer out there please assist me? |
||||
|
||||
![]() colococo Member since: 9/1/2002 |
||||
|
|
||||
| hi, i want to move this character, but i can't do it. does anyone can help me ? plz. |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| well, i definitely wouldn't consider myself an experienced programmer but here is a working c++ implementation of the quicksort algorithm: template <class Type> inline static void swap(Type *array, int i, int j) { Type temp = array; array[i] = array[j]; array[j] = temp; } template <class Type> void qsort(Type *array, int low, int high) { if (low < high) { int l = low; int h = high+1; Type elem = array[low]; for (; { while (array[++l] < elem); while (array[--h] > elem); if (l<h) swap<Type> (array, l, h); else break; } swap<Type> (array, low, h); qsort<Type> (array, low, h-1); qsort<Type> (array, h+1, high); } } hope i could help you! cheers m00c |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|