Question: Write the slowest possible terminating algorithm you can think of to sort a list of integers in increasing order. You must not use any infinite
Write the slowest possible terminating algorithm you can think of to sort a list of integers in increasing order. You must not use any infinite or idle loop.
Ex of what it should sort of look like:
procedure bubblesort(a1,...,an : real numbers with n => 2) for i := 1 to n - 1 for j := 1 to n - i if aj > aj+1 then interchange aj and aj+1
Explain how the algorithm is really slow.
Show a step by step demonstration of how the algorithm works with a made up list.
Thanks! any explaining is also welcomed!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
