can u give me an example array of the best case of quick sort?
I do understand that the best case of quick sort is when the elements are already in the pivot place., and that the complexity is O(n logn), but i m just not able to come up with a large array, that fits this condition perfectly.
tubby123
-4
Junior Poster in Training
Recommended Answers
Jump to PostThe best cast for quicksort is an already sorted array when the implementation checks for an already sorted subset. In such a case, no partitioning takes place and no recursive calls are made, which results in linear complexity:
function quicksort(a, first, last) if is_sorted(a, first, last) then …
All 2 Replies
Narue
5,707
Bad Cop
Team Colleague
jon.kiparsky
commented:
And that about covers it...
+11
mrnutty
761
Senior 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.