Q. Which is the worst method of choosing a pivot element?

  • (A) first element as pivot
  • (B) last element as pivot
  • (C) median-of-three partitioning
  • (D) random element as pivot
πŸ’¬ Discuss
βœ… Correct 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.

Explanation by: Mr. Dubey
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.

πŸ’¬ Discussion

πŸ“Š Question Analytics

πŸ‘οΈ
773
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
87%
Success Rate