Which sorting algorithm would you use for the following cases? a) The array is a
ID: 644516 • Letter: W
Question
Which sorting algorithm would you use for the following cases?
a) The array is almost sorted.
b) The array is sorted in reverse order.
c) Sorting student ids (1000nnnnnn).
d) Sorting mp3 files in your player based on the name. Hint: Note: This is a case where you want to minimize number of swaps - each file is, say 5MB. Then doing unnecessary swapping will degrade the SSD of your drive.
e) Your array is too huge to hold in memory.
f) You are given an array that was randomly shuffled.
g)The size of your array is close to the size of your RAM.
h) Sorting cheques in a bank based on the cheque id. Hint: Note that most customers use cheques in the order given in the cheque book.
Explanation / Answer
insertion sort
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.