farm ostrich - 1 year ago 62

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 Source

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!)`

.