Recently we have been asked to create a hybrid sort based upon quicksorting down to a certain point and insertion sorting from then on. We are to calculate the efficency based upon previous tests. I had very little problems implementing a quicksort algorithm, but for the life of me, I can't get anything to work on the hybrid version. Can anyone help, provide tips or pointers?
Jpowers22
1
Newbie Poster
Recommended Answers
Jump to PostRecently we have been asked to create a hybrid sort based upon quicksorting down to a certain point and insertion sorting from then on. We are to calculate the efficency based upon previous tests. I had very little problems implementing a quicksort algorithm, but for the life of me, I …
Jump to PostI always find it instructive to see what others have done, and then apply my own style and ideas to the problem. In the case of a Quicksort/Insertion sort hybrid, you could look in Google for some other folk's source code, or if you have VC++, you can look at …
Jump to PostAssuming you have an insertion sort routine, try this modification to your code:
void q_sort(int numbers[], int left, int right) { int pivot, l_hold, r_hold; // If there are few records left to look at, use an insertion sort // because it is faster. if ((right - …
All 12 Replies
subtronic
1
Junior Poster
Chainsaw
12
Posting Pro in Training
Jpowers22
1
Newbie Poster
Chainsaw
12
Posting Pro in Training
Narue
5,707
Bad Cop
Team Colleague
subtronic
1
Junior Poster
Jpowers22
1
Newbie Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
subtronic
1
Junior Poster
Narue
5,707
Bad Cop
Team Colleague
Chainsaw
12
Posting Pro in Training
subtronic
1
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.