[問題] 演算法..找第二小的元素(n+logn-2比較)

看板CSSE作者 (無法顯示)時間14年前 (2010/05/06 15:15), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/2 (看更多)
我想請教一題演算法.. Show that the second smallest of n elements can be found in (n+logn-2) comparisons in the worst case. 找第二小的元素 在最差狀況下 可以使用 n + logn - 2 次比較找到 請問這題應該從哪個部份下手會比較方便呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.228.24.185

05/06 17:27, , 1F
從logn大概可以想到用tree,方法類似winner tree
05/06 17:27, 1F
文章代碼(AID): #1BucoZhT (CSSE)
文章代碼(AID): #1BucoZhT (CSSE)