Do you use Big-O complexity evaluation in the 'real world'?

后端 未结 11 1516
失恋的感觉
失恋的感觉 2021-01-01 18:53

Recently in an interview I was asked several questions related to the Big-O of various algorithms that came up in the course of the technical questions. I don\'t think I di

11条回答
  •  Happy的楠姐
    2021-01-01 19:24

    Big-O notation is rather theoretical, while in practice, you are more interested in actual profiling results which give you a hard number as to how your performance is.

    You might have two sorting algorithms which by the book have O(n^2) and O(nlogn) upper bounds, but profiling results might show that the more efficient one might have some overhead (which is not reflected in the theoretical bound you found for it) and for the specific problem set you are dealing with, you might choose the theoretically-less-efficient sorting algorithm.

    Bottom line: in real life, profiling results usually take precedence over theoretical runtime bounds.

提交回复
热议问题