Sleep Sort

We never run out of sorting algorithms. Here is a strange sorting algorithm called the Sleep Sort.

1
2
3
4
5
6
7
8
9
procedure printNumber(n)
    sleep n seconds
    print n
end

for arg in args
    run printNumber(arg) in background
end
wait for all processes to finish

Which of the following best describes the time complexity for sleep sort?

  • Assume that the length of the array is \(n\).
×

Problem Loading...

Note Loading...

Set Loading...