→ cossetannie: merge最多是比較n個 12/11 12:17
→ pyramidinc: 我發現我有地方好像想錯 每條k個元素 這樣兩條拿來mer 12/11 12:20
→ pyramidinc: ge最多比2k-1次 然後每回合都是兩兩merge 總共要log(n 12/11 12:20
→ pyramidinc: /k) 回合 但感覺這樣答案還是不對 12/11 12:20
→ pyramidinc: 請問為什麼是n*log(n/k) ? 12/11 13:31
→ jeremyyuan: n個data 最多比n-1次喔 12/11 14:37
→ pyramidinc: 所以是兩兩比對時因為每條k個最多2k次 總共n/k條 兩兩 12/11 16:03
→ pyramidinc: 比對的話要n/2k 組 每組又是2k次 相乘就是n 不知道我 12/11 16:03
→ pyramidinc: 這樣理解有沒有錯? 12/11 16:03
→ jeremyyuan: 每條k個 最多只會比k次喔 12/11 16:21
推 cossetannie: 用整條是n個去想比較直接一點 12/11 16:34
→ pyramidinc: 好的 感謝 12/11 18:18
推 gash55025502: 我覺得這裡的merge用selection tree的k-way merge去 12/11 20:19
→ gash55025502: 想比較好想 12/11 20:19
推 gash55025502: selection tree共要做O(n)回合(因為要output n個da 12/11 20:21
→ gash55025502: ta) 每回合需花log(n/k)次比較(樹高) 12/11 20:21