Array::Heap2

Treat Perl arrays as heaps (priority queues)
Download

Array::Heap2 Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Marc Lehmann
  • Publisher web site:
  • http://www.goof.com/pcg/marc/

Array::Heap2 Tags


Array::Heap2 Description

Treat Perl arrays as heaps (priority queues) There are a multitude of heap and heap-like modules on CPAN, you might want to search for /Heap/ and /Priority/ to find many. They implement more or less fancy datastructures that might well be what you are looking for.Array::Heap2 is a Perl module that takes a different approach: It exports functions (i.e. not object orientation) that are loosely modeled after the C++ STL's heap functions. They all take an array as argument, just like perl's built-in functions push, pop etc.The implementation itself is in C for maximum speed (although I doubt it makes that much of a difference).SYNOPSIS use Array::Heap2;FUNCTIONSAll of the following functions are being exported by default.make_heap @heap (\@) Reorders the elements in the array so they form a heap, with the lowest value "on top" of the heap (corresponding to the first array element).make_heap_lex @heap (\@) Just like make_heap, but in string comparison order instead of numerical comparison order.make_heap_cmp { compare } @heap (&\@) Just like make_heap, but takes a custom comparison function.push_heap @heap, $element, ... (\@@) Adds the given element(s) to the heap.push_heap_lex @heap, $element, ... (\@@) Just like push_heap, but in string comparison order instead of numerical comparison order.push_heap_cmp { compare } @heap, $element, ... (&\@@) Just like push_heap, but takes a custom comparison function.pop_heap @heap (\@) Removes the topmost (lowest) heap element and repairs the heap.pop_heap_lex @heap (\@) Just like pop_heap, but in string comparison order instead of numerical comparison order.pop_heap_cmp { compare } @heap (&\@) Just like pop_heap, but takes a custom comparison function. Requirements: · Perl


Array::Heap2 Related Software