Contradiction in Cormen regarding Insertion sort

前端 未结 3 1189
余生分开走
余生分开走 2020-12-22 00:38

In Cormen theorem 3.1 says that


For example, the best case running time of insertion sort is big-omega(n),

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-22 01:07

    There is no contradiction here. The question only states to prove that Big-Theta(g(n)) is asymptotically tightly bound by Big-O(g(n)) and Big-Omega(g(n)). If you prove the question, you only prove that a function runs in Big-Theta(g(n)) if and only if it runs between Big-O(g(n)) and Big-Omega(g(n)).

    The insertion sort runs from Big-Omega(n) to Big-Oh(n^2), so the running time of insertion sort CANNOT be tightly bound to Big-Theta(n^2).

    As a matter of fact, CLRS never uses Big-Theta(n^2) to tightly bound insertion sort.

提交回复
热议问题