Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • 1
    @Gilles: it has low K, because it's a simple algorithm. Commented May 30, 2012 at 9:10
  • 6
    WTF? This doesn't make any sense. The simplicity of an algorithm has no relation with its running speed. Selection sort is simpler than quicksort, that doesn't make it faster. Commented May 30, 2012 at 10:15
  • 1
    @Gilles: selection sort is O(n^2) for any case (worst, average and best). So it doesn't matter how simple it is. Quicksort is O(n log n) for average case, and among all algos with O(n log n) avg it's the simplest one. Commented May 30, 2012 at 10:22
  • 1
    @Gilles: other things being equal, simplicity does aid performance. Say you're comparing two algorithms that each take (K n log n) iterations of their respective inner loops: the algorithm that needs to do less stuff per loop has a performance advantage. Commented May 31, 2012 at 16:35
  • 2
    It may be, um, simple, but it's not a tautology, and it does relate to "simplicity". Many clever algorithms which seem like they ought to have a performance advantage turn out not to have one in practice, because the overhead outweighs the cleverness. Complexity is not the same as overhead, but they are not orthogonal, either. Commented Jun 5, 2012 at 16:22