More Programming Pearls: Confessions of a Coder

Category: Computer Science
Author: Jon Louis Bentley


by anonymous   2017-09-05
Repeated reallocation for a change of one in the array size is not particularly good. You'd likely do better with allocating as much space as you'll need all at once, or keep track of what's allocated and what's in use and only allocate more when necessary. Jon Bentley's [Programming Pearls, 2nd Edn]( from 1999 and [More Programming Pearls]( from 1988 include code for handling array-based heaps as you are using. You can find an outline of that code in [this answer]( of mine.