algorithm - Big O(n logn) is not preferable over the O(n^2) -
any algorithms example when prefer big o(n^2) time complexity on o(n logn)? have seen question somewhere did not find answer.
for large problem, o(n log n) beat o(n^2). small problem, constant factors hidden big-o notation may cause prefer o(n^2) algorithm. instance, o(n log n) quicksort faster o(n^2) insert sort, quicksort implementations switch insert sort when partitions small (less ten elements).
Comments
Post a Comment