Which is the worst method of choosing a pivot element?
|A.||first element as pivot|
|B.||last element as pivot|
|D.||random element as pivot|
|Answer» A. first element as pivot|
|Explanation: choosing the first element as pivot is the worst method because if the input is pre-sorted or in reverse order, then the pivot provides a poor partition.|
Login to Continue
It will take less than 2 minutes