ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Array-Heap/README
(Generate patch)

Comparing Array-Heap/README (file contents):
Revision 1.3 by root, Fri Apr 19 20:53:56 2013 UTC vs.
Revision 1.6 by root, Tue Jul 14 23:45:10 2015 UTC

1NAME 1NAME
2 Array::Heap - treat perl arrays as heaps (priority queues) 2 Array::Heap - treat perl arrays as binary heaps/priority queues
3 3
4SYNOPSIS 4SYNOPSIS
5 use Array::Heap; 5 use Array::Heap;
6 6
7DESCRIPTION 7DESCRIPTION
113 will sort according to the first element of the arrays, i.e. "1,2,3". 113 will sort according to the first element of the arrays, i.e. "1,2,3".
114 114
115 The custom comparison functions work similar to how "sort" works: $a and 115 The custom comparison functions work similar to how "sort" works: $a and
116 $b are set to the elements to be compared, and the result should be 116 $b are set to the elements to be compared, and the result should be
117 greater than zero then $a is greater than $b, 0 otherwise. This means 117 greater than zero then $a is greater than $b, 0 otherwise. This means
118 that you cna use the same function as for sorting the array, but you 118 that you can use the same function as for sorting the array, but you
119 could also use a simpler function that just does "$a > $b". 119 could also use a simpler function that just does "$a > $b".
120 120
121 The first example above corresponds to this comparison "function": 121 The first example above corresponds to this comparison "function":
122 122
123 { $a <=> $b } 123 { $a <=> $b }
150 150
151 * This module can leak memory (or worse) when your comparison function 151 * This module can leak memory (or worse) when your comparison function
152 exits unexpectedly (e.g. "last") or throws an exception, so do not 152 exits unexpectedly (e.g. "last") or throws an exception, so do not
153 do that. 153 do that.
154 154
155SEE ALSO
156 This module has a rather low-level interface. If it seems daunting, you
157 should have a look at Array::Heap::ModifiablePriorityQueue, which is
158 based on this module but provides more and higher-level operations with
159 an object-oriented API which makes it harder to make mistakes.
160
161 A slightly less flexible (only numeric weights), but also slightly
162 faster variant of that module can be found as
163 Array::Heap::PriorityQueue::Numeric on CPAN.
164
155AUTHOR AND CONTACT INFORMATION 165AUTHOR AND CONTACT INFORMATION
156 Marc Lehmann <schmorp@schmorp.de> 166 Marc Lehmann <schmorp@schmorp.de>
157 http://software.schmorp.de/pkg/Array-Heap 167 http://software.schmorp.de/pkg/Array-Heap
158 168

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines