farm ostrich farm ostrich - 2 years ago 88
Java Question

What is the most inefficient sorting routine?

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

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