Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because they want to make sure that the sorting algorithm works well for all possible workloads, not just the most preferable ones.

If we measured sorting algorithms by the fastest measurement, we might conclude that BubbleSort is the fastest possible sort algorithm on some inputs. (Bubblesorting an already-sorted list makes at most one comparison per list element)



I don't think that's what they meant (or I have misunderstood). Running the same algorithm on the same input still has variations because of OS/CPU idiosyncrasies. When measuring performance we usually run the algorithm on the same input multiple times and report the fastest performance.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: