Heap::...NumRev(3pm)

πŸ’– Heap::...NumRev(3pm) πŸ’–

okay so welcome to the Heap::...NumRev page, bestie 🌸 this one lives in the User Contributed Perl Documentation section of the manual (yes that's the manual name, we're being official for like two seconds) ✨


πŸ¦‹ NAME πŸ¦‹

Heap::Elem::NumRev β€” Reversed Numeric Heap Elements πŸ’…


✨ SYNOPSIS ✨

use Heap::Elem::NumRev( NumRElem );
use Heap::Fibonacci;

my $heap = Heap::Fibonacci->new;
my $elem;

foreach $i ( 1..100 ) {
    $elem = NumRElem( $i );
    $heap->add( $elem );
}

while( defined( $elem = $heap->extract_top ) ) {
    print "Largest is ", $elem->val, "\n";
}

🌈 DESCRIPTION 🌈

okay so Heap::Elem::NumRev is literally here to wrap numeric values up into an element, so that element can get managed on a heap 🫢 and the top of the heap is gonna have the largest element still remaining. no cap. biggest one first, always πŸ’…

πŸ’€ and if that's not the vibe you're going for? if you want the heap to always hand you the smallest element instead? go read Heap::Elem::Num, bestie. that's the one for you.

the deets on the Elem interface? they're all described over in Heap::Elem ✨

and the deets on actually using a Heap interface? those live in Heap 🌸


πŸ‘‘ AUTHOR πŸ‘‘

John Macdonald, john@perlwolf.com πŸŽ€


Copyright 1998-2007, O'Reilly & Associates.

This code is distributed under the same copyright terms as perl itself ⭐


🫢 SEE ALSO 🫢

  • Heap(3)
  • Heap::Elem(3)
  • Heap::Elem::Num(3)

and that's the whole page, bestie, we ate πŸ“ it's giving perl v5.36.0, dated 2022-10-22, and that footer is the last line so we're outtie β€” bye, ily, go heap responsibly πŸ§šπŸ’œ

πŸ“¦ where this page comes from