Modified Quicksort algorithm
  • recursion
  • array
  • sorting
  • quicksort
  •   
  • Posted: 6 years ago
  • Updated: 5 years ago
  • Edit
  • answers (1)
  • views (7026)

In Quicksort algorithm, there are two recursive calls to itself - after PARTITION, the left subarray is recursively sorted and then the right subarray. How will you modify Quicksort algorithm so that the second recursive call on the right subarray can be avoided, but sorted correctly.


Posted Answers



MODIFIED_Quicksort(A,p,r)
while(p < r)
/* Partition and sort left subarray */
do
q = PARTITION(A,p,r);
MODIFIED_Quicksort(A,p,q-1);
p = q+1;

You need to Sign In to post your solution.