I'm having a problem with my sorting algorithm. before I made quick sort which used insertion sort, but I don't want to use this insertion sort. I want to use recursive algorithm. Also, I want to get new idea, so If you know any quick sort algorithm, reply for me.Please~ :rolleyes:
Good quicksort implementations use insertion sort as the final step. Or do you mean you wrote an insertion sort algorithm and called it quicksort? :rolleyes: The basic recursive algorithm is simple:
void quicksort ( type a, int l, int r )
{
int i;
if ( r <= l )
return;
i = partition ( a, l, r );
quicksort ( a, l, i - 1 );
quicksort ( a, i + 1, r );
} Because your post was appropriately vague, I'll do the same and not include the implementation of partition. ;)
Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401