A Modified Parallel Heapsort Algorithm

A Modified Parallel Heapsort Algorithm

Hiroaki Hirata, Atsushi Nunome
Copyright: © 2020 |Pages: 18
DOI: 10.4018/IJSI.2020070101
OnDemand:
(Individual Articles)
Available
$37.50
No Current Special Offers
TOTAL SAVINGS: $37.50

Abstract

Sorting is a fundamental and essential problem required in the wide range of application fields, and so many sorting algorithms have been developed. Among those algorithms, heapsort is one of the most elegant and efficient sorting algorithms. But no parallel heapsort algorithm had been presented until the authors developed a restricted parallel algorithm a few years ago. This parallel algorithm had a restriction which makes it difficult to be used universally for general data sets. So, in this article, the authors present a modified parallel algorithm which is free from such restriction and can be used for any data set. This new algorithm can achieve almost the same performance as the restricted algorithm the authors developed before.
Article Preview
Top

Heapsort Algorithm

Figure 1 shows the C language-like pseudo-code for heapsort. In its first stage, the algorithm builds a heap tree bottom-up (at lines 2 and 3 of Figure 1). A heap tree is a half-ordered binary tree whose elements are stored in a linear array. Assume that IJSI.2020070101.m04 values are stored in elements of an array: a[1], a[2], IJSI.2020070101.m05, a[IJSI.2020070101.m06]. As shown in Figure 2, a[IJSI.2020070101.m07] and a[IJSI.2020070101.m08] are child nodes of a[IJSI.2020070101.m09]. In heap trees, the following condition must be satisfied: the value of a node is greater than or equal to the values of its child nodes. Which child node has the smaller value is not defined.

Figure 1.

Heapsort algorithm

IJSI.2020070101.f01
Figure 2.

Heap tree

IJSI.2020070101.f02

The procedure DownHeap(k,m) of Figure 1 moves the value of the node a[IJSI.2020070101.m10] downward in the tree that consists of a[1], a[2], IJSI.2020070101.m11, a[IJSI.2020070101.m12], IJSI.2020070101.m13, a[IJSI.2020070101.m14] so that the above condition of heap trees can be satisfied. In the example of Figure 3, the value 16 stored in a[IJSI.2020070101.m15] is moved to nodes closer to leaves of the tree. The values 30, 24, and 17 (which are larger than 16) are shifted up toward the root of the tree. By repeating this “downheap” operation, from nodes whose children are the leaf nodes to the root node, a heap tree can be built.

Complete Article List

Search this Journal:
Reset
Volume 12: 1 Issue (2024)
Volume 11: 1 Issue (2023)
Volume 10: 4 Issues (2022): 2 Released, 2 Forthcoming
Volume 9: 4 Issues (2021)
Volume 8: 4 Issues (2020)
Volume 7: 4 Issues (2019)
Volume 6: 4 Issues (2018)
Volume 5: 4 Issues (2017)
Volume 4: 4 Issues (2016)
Volume 3: 4 Issues (2015)
Volume 2: 4 Issues (2014)
Volume 1: 4 Issues (2013)
View Complete Journal Contents Listing