59.2k views
1 vote
Arrange the names Brenda, Doris, Raymond, Steve, Timothy, and William in an order that requires the least number of comparisons when sorted by the insertion sort algorithm.

User Jagdeep
by
7.6k points

1 Answer

6 votes

They are already alphabetically ordered, which is optimal for insertion sort because insertion sort will go through the list only once, i.e. O(n).

User Heng
by
7.9k points