farm ostrich - 1 year ago 58

Java Question

For an array of integers, what is the least efficient way of sorting the array. The function should make progress in each step (eg no infinity loop). What is the runtime of that algorithm?

Answer

The stupid sort is surely the worst algorithm. It's not exactly an infinite loop but this approach has as worst case `O(inf)`

and the avarage is `O(n × n!)`

.

Source (Stackoverflow)