1. Introduction
Heapsort [Williams, (1964)] as described in the original paper is one of the most
widely used sorting algorithms which runs in O(n log n) time and sorts in-place (log
implies throughout the paper base 2). It is known that O(n log n) is the optimal
asymptotic running time upper bound for any comparison-based sorting algorithm.
Even though mergesort gets closely to this optimum, it requires an array of O(n)
auxiliary space. Heapsort belongs to the family of algorithms that sort by selection
and requires O(1) auxiliary space, falling into the category of in-place algorithms. An
in-place sorting algorithm allows maximizing the usage of the main memory using
input data instead of keeping a large amount of auxiliary data. Several efforts have
been made to improve the performance of sorting, because it is one of the most
crucial problems in computer science [Knuth, (1998)] (section 5.5). Consequently,
improved versions of heapsort have been proposed in the literature. Bottom-upheapsort
[Wegener, (1993)] and ”shiftdown” process [Schaffer and Sedgewick,
(1993)] modify the way the heap property is maintained by changing how it is
constructed or reconstructed after the removal of its root, while weak-heapsort
[Edelkamp and Wegener, (2000)] defines a new heap structure and outperforms the
other implementations in some cases [Edelkamp and Wegener, (2000), Edelkamp and
Stiegeler, (2001)]. Weak-heapsort uses one more bit for each element in the heap that
is not in-place.
1. บทนำHeapsort [วิลเลียมส์, (1964)] ตามที่อธิบายไว้ในกระดาษเดิมเป็นหนึ่งในสุดใช้อัลกอริทึมซึ่งทำงานในเวลา O (n n ล็อก) และเรียงลำดับ (เข้าสู่ระบบในตำแหน่ง การเรียงลำดับหมายถึงตลอดทั้งกระดาษฐาน 2) เป็นที่ทราบกันว่า O (บันทึก n n) ที่เหมาะสมเวลาทำงาน asymptotic บนผูกพันสำหรับใด ๆ เปรียบเทียบคะแนนการเรียงลำดับขั้นตอนวิธีแม้ว่า mergesort ที่ได้รับนี้อย่างใกล้ชิดถึงที่เหมาะสม มันต้องใช้อาร์เรย์ของ O(n)เสริมพื้นที่ Heapsort เป็นสมาชิกของครอบครัวของอัลกอริทึมที่เรียงลำดับตามสิ่งที่เลือกและต้องการเนื้อที่ว่างเสริม O(1) การตกไปอยู่ในประเภทของอัลกอริทึมในตำแหน่ง มีอัลกอริทึมการเรียงลำดับในตำแหน่งที่ช่วยให้เพิ่มการใช้งานของหน่วยโดยใช้ข้อมูลที่ป้อนแทนการรักษาข้อมูลเสริมจำนวนมาก มีความพยายามหลายได้ทำการปรับปรุงประสิทธิภาพของการเรียงลำดับ เพราะมันเป็นหนึ่งในสุดปัญหาที่สำคัญในวิทยาการคอมพิวเตอร์ [Knuth, (1998)] (ส่วน 5.5) ดังนั้นรุ่น heapsort ได้รับการเสนอชื่อในวรรณคดี ด้านล่าง-upheapsort[Wegener, (1993)] และกระบวนการ "shiftdown" [หน้าและ Sedgewick(1993)] ปรับเปลี่ยนวิธีการกองไว้ โดยการเปลี่ยนวิธีเป็นสร้าง หรือสร้างขึ้นใหม่หลังจากที่เอาของราก ขณะอ่อน-heapsort[Edelkamp และ Wegener, (2000)] กำหนดโครงสร้าง heap ใหม่ และมีประสิทธิภาพสูงกว่าการใช้งานอื่น ๆ ในบางกรณี [Wegener, (2000), Edelkamp และ Edelkamp และStiegeler, (2001)] ใช้ heapsort อ่อนหนึ่งบิตเพิ่มเติมสำหรับแต่ละองค์ประกอบในฮีปที่ไม่ได้แทน
การแปล กรุณารอสักครู่..
