in reply to Re^2: Sorting Hash By Large Number Values
in thread Sorting Hash By Large Number Values
By adding " 'max_count' => 10 " at heap creation time, you can limit the number of elements tracked in the heap. As new elements are added, inferior elements past the top ten will be dropped. That will reduce the amount of time needed to add elements and improve the efficiency of the heap solution. Of course then you don't have a heap full of values, but instead only the top ten, which may limit the datastructure's usefulness later in the script if the heap is needed again.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Sorting Hash By Large Number Values
by anonymized user 468275 (Curate) on Aug 03, 2005 at 15:40 UTC |