[Alg10] 關於堆積樹的問題……

6 views
Skip to first unread message

張凱傑

unread,
Apr 16, 2010, 11:02:54 PM4/16/10
to SJ10-Algorithm
請問老師,若想要使用堆積排序,會使用「刪除節點」的方法,但如此資料會被全部刪除,如果想要再次使用堆積樹,是否又要重建一次?(那麼每排序一次,資
料便全部刪除一次?)

請問有沒有別的方法可以得到排序資料?


--
Subscription settings: http://groups.google.com/group/sj10-algorithm/subscribe?hl=zh-TW

Shyong Jian Shyu

unread,
Apr 16, 2010, 11:51:18 PM4/16/10
to sj10-al...@googlegroups.com
凱傑:
 
好問題!!
 
使用"堆積" (heap), 旨在動態新增或刪除有順序 priority 的資料 (如: 把排隊的人存成 heap, 依其 priority 照順序買票(進入/處理...)
關鍵在"動態"資料 (我們不會把每次演唱會排隊買票的觀眾/每次排隊進週會禮堂的學生/... 存留記下)
 
若資料不是"動態"的, 要存留記下的, 可用"二元搜尋樹"或直接用陣列處理記存!!
 
熊大

Reply all
Reply to author
Forward
0 new messages