News for hackers. Stuff that matters.
Re:Instant flood fill with HTML Canvas by kragen on Wednesday May 24, 2023 @02:36AM (#36054816)
agreed, except that the reason it's never a good idea to use bubble sort is that insertion sort is just as simple and always performs much better; there are cases where insertion sort really is the right thing to use despite its usually quadratic performance

there might even be a case where the single-loop sort is the right thing to use, despite its abominable performance, because it's simpler than bubble sort or insertion sort

    for (i = 1; i < n; i++)
      if (a[i-1] > a[i]) t = a[i], a[i] = a[i-1], a[i-1] = t, i = 1;

There are no comments on this comment yet.