Heap Sorting Based on Array Sorting

A kind of heap sorting method based on array sorting was proposed. Some advantages and disadvantages of it were discussed. It was compared with the traditional method of direct application. In the method, the ordered keywords in the array are put into the heap one by one after building an empty heap. This method needs relatively less space and is fit for ordered sequence.


Introduction
In the field of computer algorithm design, sorting algorithm is one of the important methods which is used to process date.Heap sort algorithm's time complexity is relatively low [1] [2] [3] [4].So if we can understand its thought very well and use it flexibly, we will solve many problems in our life.
In computer science, heapsort is a comparison-based sorting algorithm.
Heapsort can be thought of as an improved selection sort: like that algorithm, we can quickly locate the elements of the required index by using the characteristics of the array [5] [6].Heap is a completely two binary tree that in ordered set, satisfies the following properties of the heap that the max key value of the key elements of every node in heaps is no more bigger than it in parent node (just in terms of maximum heap terms).Therefore, the largest element of the heap is stored in the root node (the minimum heap similarly, no longer).When we realize the stack with an array of H[1•••N], according to the order of top-down and from left to right in turns, we can store the elements of the heap in the array elements of H [1], H [2] It is easy to find that there is a large amount of calculation in the process of reconstructing the heap, and the efficiency of reconstruction depends on comparing between the number of elements and moving of heap elements.The commonly used reconstruction algorithm Heapify [1] [2] makes the node elements along anyone path down.Each layer needs to be compared for 2 times, and the left and right son node elements compare for 1 time.Then the larger one does with the parent node elements for another time.This process is repeated until the parent element is no less than the son node elements (the maximum heap).
There is an example of depth h: Numbers of keywords comparison are at least ( )

Reference Knowledge
1) Heap: it can be defined as a two binary tree where each node has one key.
There are some requirements: a) The shape of a tree: every layer of the tree is full except the rightmost element on the last floor.In an ideal situation, every time the array to be sorted will be divided into two parts as long as each other, and it needs log(2,n) times division.In the worst case that an array has ordered or roughly ordered, only one element of each partitioning can be divided every time.The lower bound of time complexity is O(nlog(2,n) and the worst case is O(n^2).In actually, the average value of time complexity is O(nlog(2,n).
2 The stability of two methods is caused by the disagreement of its relationship between father and son nodes with its subscript rules.But the stability can be promised if exchanging their conditions which are comprised.Besides, the two elements which have the same keyword may be belong to different parent nodes, so stability is not confirmed.

Conclusion
This paper presents a heap sorting algorithm based on array and finishes the comparison with the traditional method of direct application.In the larger array sequence, the heap sorting algorithm is applied directly.Its time complexity is as same as quick sort and merging sort.It can run with less storage space, so it's fit for ordered sequence sorting.The application of principle reflected that the algorithm is especially suitable for the realization of priority queue.

1 h
− times in the selection sort algorithm.When building the heap which has n elements and h depth, the numbers should be less 4n for Formula (1).The depth of a complete two fork tree is [ ] 2 log 1 n + .In the process of the heap re- built, the Heapad just is invoked n − 1 times.The total numbers of comparison should be no more than worst case is that we should do 2nlogn + O(n) comparison and nlogn O(n) times elements moving.About the study of the heap sort, there are now many studies analyzing that and putting forward the optimization plan of it based on different views for the heap sort, such as some reference papers like Mr. Wu Shangzhi who published the "heap sorting algorithm improvement and complexity analysis on the heap" in 2002 at the Journal of Northwest Normal University (Natural Science Edition).It improves the traditional sorting algorithm and reduces the complexity of the algorithm.
heap, presented already by Williams as a useful data structure in its own right: in this algorithm, establishing the initial stack by O (n) time; then continually exchanging the top element with the bottom element to reconstruction of the heap.Eventually, all the elements are in good order.In the same year, R. W. Floyd published an improved version that could sort an array in-place, continuing his earlier research into the treesort algorithm.It only needs one record size of auxiliary space to use heap sort.And each record to be sorted only takes up one storage space.