farm ostrich - 2 years ago 88

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?

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

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

.

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**