Abstract:
This paper puts forward an improvement on an enumeration algorithm of generation all heaps. Recursion judgement on left subtree and right subtree and judegment of hierarchy are combined to raise the efficiency of the algorithm. The test results indicate the validity and reliability of the algorithm.
Key words:
Generation,
Heap,
Recursion algorithm,
Judgement of hierarchy subtree
摘要: 提出了一种生成所有堆的枚举算法,该算法采用了递归子树判断法,递归地将待生成的堆分为左右2个子树判断,并结合层次判断方法,提高了算法的效率,测试结果验证了该算法的有效性和可靠性。
关键词:
生成,
堆,
层次算法,
递归子树判断
DU Huijiang; SUN Qiang. Enumeration Algorithm of Generation All Heaps[J]. Computer Engineering, 2006, 32(20): 62-64.
杜慧江;孙 强. 一种生成所有堆的枚举算法[J]. 计算机工程, 2006, 32(20): 62-64.