首页 | 本学科首页   官方微博 | 高级检索  
     


All‐in‐one implementation framework for binary heaps
Authors:Jyrki Katajainen
Affiliation:Department of Computer Science, University of Copenhagen, Copenhagen East, Denmark
Abstract:Even a rough literature review reveals that there are many alternative ways of implementing a binary heap, the fundamental priority‐queue structure loved by us all. Which one of these alternatives is the best in practice? The opinions of crowd‐pullers and textbook authors are aligned: use an array. Of course, the correct answer is ‘it depends’. To get from opinions to facts, a framework—a set of class templates—was written that provides a variety of customization options so it could be used to realize a large part of the proposed variants. Also, some of the derived implementations were performance benchmarked. From this work, three conclusions can be drawn: (i) It is difficult to achieve space efficiency and speed at the same time. If n denotes the current number of values in the data structure, ? is a small positive real, ?  < 1, and urn:x-wiley:spe:media:spe2423:spe2423-math-0001 denotes the size of the values of type urn:x-wiley:spe:media:spe2423:spe2423-math-0002 in bytes, space efficiency means urn:x-wiley:spe:media:spe2423:spe2423-math-0003 bytes of space, and speed means O (lgn ) worst‐case time per push and pop . (ii) If an array‐based solution is sufficient, Williams' original program from 1964 is still to this day hard to beat. (iii) Sometimes a linked structure and clever programming is a viable option. If the binary‐heap variant you need is not available at the software library you are using, reading this essay might save you some headaches. Copyright © 2016 John Wiley & Sons, Ltd.
Keywords:customizable software libraries  adaptable component frameworks  data structures  binary heaps  generic programming  benchmarking
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号