Heap::...StrRev(3pm)
β¨ NAME β¨
Heap::Elem::StrRev β Reversed String Heap Elements π
okay so bestie, this is Heap::Elem::StrRev from the Perl docs, and it's giving exactly what it says on the tin π
πΈ SYNOPSIS πΈ
use Heap::Elem::StrRev( StrRElem );
use Heap::Fibonacci;
my $heap = Heap::Fibonacci->new;
my $elem;
foreach $i ( 'aa'..'bz' ) {
$elem = StrRElem( $i );
$heap->add( $elem );
}
while( defined( $elem = $heap->extract_top ) ) {
print "Largest is ", $elem->val, "\n";
}
π¦ DESCRIPTION π¦
Heap::Elem::StrRev wraps string values into an element that a heap can manage, no cap. π«Ά
The top of the heap will have the largest element still remaining. So yeah, it flips the vibe β instead of smallest-first, you get biggest-first, and it's iconic for that.
Not me casually pointing out: if you actually want the heap to always hand you the smallest element, go check out Heap::Elem::Str, which is right there in the SEE ALSO π
The deets of the Elem interface? Those live in Heap::Elem, described in full, no gatekeeping.
And the deets of using a Heap interface? Those are described in Heap. respectfully, go read them, they ate. π
π AUTHOR π
John Macdonald, john@perlwolf.com
π COPYRIGHT π
Copyright 1998-2007, O'Reilly & Associates.
This code is distributed under the same copyright terms as perl itself.
π SEE ALSO π
and that's the whole page, bestie, we're done π this was pulled from perl v5.36.0, dated 2022-10-22 β slay, periodt. β¨
π¦ where this page comes from
- ubuntu noble: libheap-perl 0.80-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libheap-perl 0.80-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libheap-perl 0.80-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms