0001 /****************************************************************************************** 0002 * Data Structures in C++ 0003 * ISBN: 7-302-33064-6 & 7-302-33065-3 & 7-302-29652-2 & 7-302-26883-3 0004 * Junhui DENG, deng@tsinghua.edu.cn 0005 * Computer Science & Technology, Tsinghua University 0006 * Copyright (c) 2003-2019. All rights reserved. 0007 ******************************************************************************************/ 0008 0009 template <typename T> void heapify ( T* A, const Rank n ) { //Floyd建堆算法,O(n)时间 0010 for ( int i = n/2 - 1; 0 <= i; i-- ) //自底而上,依次 0011 percolateDown ( A, n, i ); //下滤各内部节点 0012 }