Heap::Fibonacci(3pm)

πŸ’– Heap::Fibonacci πŸ’–

okay bestie so this is Heap::Fibonacci, a User Contributed Perl Documentation page (that's the manual section situation, it's filed as Heap::Fibonacci(3pm)) and honestly? it's giving ✨ elegant✨ algorithm energy, no cap.


🌸 NAME 🌸

Heap::Fibonacci β€” a fibonacci heap to keep data partially sorted πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

use Heap::Fibonacci;

$heap = Heap::Fibonacci->new;
# see Heap(3) for usage

like, that's it. that's the whole vibe. three lines and you're in 🫢


✨ DESCRIPTION ✨

so what does it actually do? It keeps elements in heap order using a linked list of Fibonacci trees. 🧚 yes, a whole linked list of trees. forest behavior.

and the way it tracks things: the heap method of an element is used to store a reference to the node in the list that refers to the element. so every element literally knows exactly which node in that list is its node. main character energy, truly, everyone gets their own node and their own little back-reference πŸ’…

See Heap for details on using this module. ← that's where the actual how-to-use-it lives, so go read that one too, don't ghost it, iykyk.


πŸ‘‘ AUTHOR πŸ‘‘

John Macdonald, john@perlwolf.com β€” we love a credited legend ⭐


Copyright 1998-2007, O'Reilly & Associates.

This code is distributed under the same copyright terms as perl itself. (translation: same legal rules as perl, periodt. don't be weird about it. πŸ™ˆ)


🌈 SEE ALSO 🌈

  • Heap(3) β€” the main usage guide, your first stop fr fr
  • Heap::Elem(3) β€” the element side of the story

lowkey the whole point is partially sorted data β€” it doesn't fully sort anything for you, it just keeps the heap order together. setting expectations correctly is self-care. πŸ’–

and that's the page!! πŸ’• this was perl v5.36.0, dated 2022-10-22, filed under Heap::Fibonacci(3pm) β€” slay, go build a forest of Fibonacci trees bestie, you got this πŸŽ€βœ¨

πŸ“¦ where this page comes from