Heap Sort:Heapsort uses the property of Heaps to sort an array. The Heap data structure is an array object that can be viewed as a complete and balanc...
                            
                            
                                分类:
其他好文   时间:
2014-09-25 19:07:27   
                                阅读次数:
257
                             
                    
                        
                            
                            
                                Collection of algorithm for sorting
heap sort 堆排序
               The heapsort algorithm can be divided into two parts.
               In the first step, a heap is built out
 of the data. The h...
                            
                            
                                分类:
其他好文   时间:
2014-09-19 19:24:45   
                                阅读次数:
220
                             
                    
                        
                            
                            
                                Heapsort (堆排序)是最经典的排序算法之一,在google或者百度中搜一下可以搜到很多非常详细的解析。同样好的排序算法还有quicksort(快速排序)和merge sort(归并排序),选择对这个算法进行分析主要是因为它用到了一个非常有意思的算法技巧:数据结构 - 堆。而且堆排其实是一个看...
                            
                            
                                分类:
编程语言   时间:
2014-09-16 23:29:41   
                                阅读次数:
406
                             
                    
                        
                            
                            
                                堆排序: 1 #include 2 //#include 3 4 void PrintArray(int data[] ,int length){ 5 int i; 6 for(i=0;iA[i]){21 largest=l;22 }23 else ...
                            
                            
                                分类:
其他好文   时间:
2014-09-04 04:11:17   
                                阅读次数:
210
                             
                    
                        
                            
                            
                                大根堆排序的基本思想: 1) 先将初始文件R[1..n]建成一个大根堆,此堆为初始的无序区; 2) 再将关键字最大的记录R[1](即堆顶)和无序区的最后一个记录R[n]交换, 由此得到新的无序区R[1..n-1]和有序区R[n],且满足R[1..n-1].keys≤R[n].key; 3) 由于交换...
                            
                            
                                分类:
其他好文   时间:
2014-08-30 20:22:29   
                                阅读次数:
168
                             
                    
                        
                            
                            
                                1 /************************************************************************* 2 > File Name: HeapSort.cpp 3 > Author: zhoukang 4 > Mail: z...
                            
                            
                                分类:
编程语言   时间:
2014-08-11 11:55:42   
                                阅读次数:
168
                             
                    
                        
                            
                            
                                堆排序的时间复杂度是O(nlogn),下面上代码
public class HeapSort {
	public void adjustHeap(int[] in, int index, int length) {
		int leftcIndex = index * 2 + 1;
		int rightcIndex = index * 2 + 2;
		int bigest = index;...
                            
                            
                                分类:
其他好文   时间:
2014-08-08 16:04:16   
                                阅读次数:
210
                             
                    
                        
                            
                            
                                package com.peter.app.hello.heapsort;/** * heap sort * @author Peter.Yu * */public class HeapSort { public static int COUNT = 0; /** * build heap * @param a * @param size */ public static void buildHe...
                            
                            
                                分类:
编程语言   时间:
2014-08-06 19:27:52   
                                阅读次数:
269
                             
                    
                        
                            
                            
                                一、二叉堆含义及属性: 堆(heap)亦被称为:优先队列(priority queue),是计算机科学中一类特殊的数据结构的统称。堆通常是一个可以被看做一棵完全二叉树的数组对象。在队列中,调度程序反复提取队列中第一个作...
                            
                            
                                分类:
其他好文   时间:
2014-07-31 10:02:36   
                                阅读次数:
470
                             
                    
                        
                            
                            
                                堆数据结构是一种数组对象,它可以被视为一棵完全二叉树。时间复杂度为:O(n*logn),空间复杂度:O(1);平均时间复杂度和最坏时间复杂度都为:O(n*logn),但堆排序是不稳定排序。堆排序思路: 1.建立小堆:把堆看成一个完全二叉树,然后从这棵树的最大非叶子节点开始,比较...
                            
                            
                                分类:
其他好文   时间:
2014-07-05 11:12:28   
                                阅读次数:
249