How many passes does bubble sort need, at most, to sort a list of n items?
- log2 n
- n - 1
- n
- 2n
Answer
B) n - 1
After each pass one more item is in its final place; after n-1 passes all are sorted. SLO CS-11-B-02 · Understanding
Computer Science MCQ · More Unit 2: Computational Thinking and Algorithms MCQs · Practise