[問題] heap調整

看板C_and_CPP (C/C++)作者 (嵐)時間13年前 (2012/12/15 15:58), 編輯推噓0(002)
留言2則, 2人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) c++ 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 調整失敗 餵入的資料(Input): number[5] = {10,40,20,5,6} 預期的正確結果(Expected Output): MAX_Heap tree:40 10 20 5 6 錯誤結果(Wrong Output): MAX_Heap tree:40 20 10 5 6 程式碼(Code):(請善用置底文網頁, 記得排版) http://codepad.org/YT7hgcTY 補充說明(Supplement): http://caterpillar.onlyfun.net/Gossip/AlgorithmGossip/HeapSort.htm 我是拿這個程式碼改的 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 111.242.12.224 ※ 編輯: artorius 來自: 111.242.12.224 (12/15 16:01)

12/15 17:48, , 1F
你的 parent id 算錯了
12/15 17:48, 1F

12/15 18:12, , 2F
良葛格是用1開始的喔
12/15 18:12, 2F
文章代碼(AID): #1Gp2svbF (C_and_CPP)
文章代碼(AID): #1Gp2svbF (C_and_CPP)