正在加载图片...
Worst-case Analysis for Max-Heapify 过程Max-Heapify中不包含循环,所以,如果不递归,其 代价是O(1)。 口如果考虑比较运算的次数,每“下沉”一层,执行2次比较。 ·递归:T(m)≤T(2n/3)+Θ(1) 问题5: 为什么? The solution to this recurrence,by case 2 of the master theorem (Theorem 4.1). is T(n)=0(lg n).Altematively,we can characterize the running time of MAX- HEAPIFY on a node of height h as O(h).Worst-case Analysis for Max-Heapify  过程Max-Heapify中不包含循环,所以,如果不递归,其 代价是O(1)。  如果考虑比较运算的次数,每“下沉”一层,执行2次比较。  递归:
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有