作者jas1123kimo (傑森)
看板Grad-ProbAsk
標題[理工] 演算法一題(d-heap sort)
時間Tue Oct 22 15:52:20 2013
有一題題目看不太懂
出自原文書
e.Give an efficient implementation of INCREASE-KEY(A,i,k),which first
sets A[i]←max(A[i],k) and then updates the d-ary max-heap structure
appropriately. Analyze its running time in terms of d and n.
解答:
如果 k<A[i],flag an error
否則 set A[i]=k,再與其 parent 比較做調整。
running time=Θ(logdn)
有人能跟我解釋題目的意思嗎
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.114.78.123
推 A4P8T6X9:把某一個node的data變大,調整要多少時間,就是樹高。 10/22 16:08
→ jas1123kimo:那 A i k代表什麼呢? 10/22 16:11
→ A4P8T6X9:A樹,i 第幾個node,k 要改的值。 10/22 16:22