3,629 views
1 1 vote
1) Randomly picking up to make worst case less 
   likely to occur.
2) Calling insertion sort for small sized arrays 
   to reduce recursive calls.
3) QuickSort is tail recursive, so tail call 
   optimizations can be done.
4) A linear time median searching algorithm is used 
   to pick the median, so that the worst case time 
   reduces to O(nLogn)

I am not getting points 2 and having confusion in point 3 that how quicksort can be tail-recursive since we have 2 function calls at the end , and why is option 4 wrong ,since if we pick the pivot as median then surely It will divide the array equally into two halves therefore worst case time complexity must be O(n log n ) , plz correct me where am I wrong ?

3 Answers

Position:
Show:

Related questions

0 0 votes
0 0 answers
479
479 views
Gurdeep Saini asked Nov 13, 2018
479 views
between hoare and loranto quicksort which give better cache performance ?we know that in hoare quicksort we move the pointer i,j in different direction but in loranto qui...
9 9 votes
2 answers 2 answers
23.4k
23.4k views
0 0 votes
2 2 answers
1.9k
1.9k views
dhruba asked Jun 5, 2023
1,901 views
Binary search is performed on a sorted array of n elements. The search key is not in the array and falls between the elements at positions m and m+1 (where 1 ≤ m < n). Ho...
0 0 votes
1 1 answer
1.3k
1.3k views
LavTheRawkstar asked Jan 12, 2017
1,313 views
INSERTION-SORT (A, n) ⊳ A[1 . . n]for (j ← 2 to len(A) ){key ← A[ j];i ← j – 1 ; while (i 0 and A[i] key) { A[i+1] ← A[i...