Parano...VLNode(3pm)
β¨ Paranoid::Data::AVLTree::AVLNode β the 3pm girlies know π
okay so bestie, welcome to Paranoid::Data::AVLTree::AVLNode, a whole module living in the Paranoid::Data::AVLTree family, and honestly? she's the moment. π
πΈ VERSION πΈ
$Id: lib/Paranoid/Data/AVLTree/AVLNode.pm, 2.10 2022/03/08 00:01:04
acorliss Exp $
no cap, that's the actual version line, don't touch it, it's sacred. π
π¦ SYNOPSIS π¦
$node = Paranoid::Data::AVLTree::AVLNode->new($key, $val);
$key = $node->key;
$val = $node->val;
$rv = $node->setVal($val);
$ref = $node->right;
$rv = $node->setRight($node);
$ref = $node->left;
$rv = $node->setLeft($node);
$rv = $node->incrRHeight;
$rv = $node->incrLHeight;
$rv = $node->addRHeight($n);
$rv = $node->addLHeight($n);
$rv = $node->decrRHeight;
$rv = $node->decrLHeight;
$balance = $node->balance;
$count = $node->count;
$height = $node->height;
$height = $node->rHeight;
$height = $node->lHeight;
$rv = $node->updtHeights;
@crefs = $node->children;
like, that's the whole vibe in one code block. screenshot it, memorize it, slay. πΈβ¨
π DESCRIPTION π
so this class hands you the core data objects that make up an AVL-balanced tree. she's the building block. the little node doing the heavy lifting. main character energy, honestly. π
π§ SUBROUTINES/METHODS π§
π new
$node = Paranoid::Data::AVLTree::AVLNode->new($key, $val);
makes you a brand new AVLNode object, periodt. and listen β just like hashes, the key must be defined, and it cannot be a zero-length string. if you try either of those things? this method hands you back undef. it's giving "not today." π
ββοΈ
π key
$key = $node->key;
returns the key for the node. that's it. that's the tweet. π
π val
$val = $node->val;
returns the associated value for the node. lowkey important: it can be undef. so don't come for her when it's empty, that's allowed. π
π setVal
$rv = $node->setVal($val);
sets the associated value for the node. glow-up for your data. β¨
π right
$ref = $node->right;
grabs you a reference to the next right-side node in the branch β if there even is one, iykyk. π«Ά
π setRight
$rv = $node->setRight($node);
sets or removes the reference to the next right-side node in the branch. she can add, she can delete, she contains multitudes. π
π left
$ref = $node->left;
grabs you a reference to the next left-side node in the branch, if any. the other side of the story. π
π setLeft
$rv = $node->setLeft($node);
sets or removes the reference to the next left-side node in the branch. same energy, other direction. πͺ
π incrRHeight
$rv = $node->incrRHeight;
increments the height counter for the ride-side sub-branch. (yes, the original says "ride-side", and we respect the typo, we do not correct the typo, the typo is iconic now.) π
π incrLHeight
$rv = $node->incrLHeight;
increments the height counter for the left-side sub-branch. β¬οΈ
π addRHeight
$rv = $node->addRHeight($n);
adds the value you passed to the height counter for the right-side sub-branch. math but make it cute. π’
π addLHeight
$rv = $node->addLHeight($n);
adds the value you passed to the height counter for the left-side sub-branch. π
π decrRHeight
$rv = $node->decrRHeight;
decrements the height counter for the right-side sub-branch. going down, but in a healthy way. β¬οΈ
π decrLHeight
$rv = $node->decrLHeight;
decrements the height counter for the left-side sub-branch. π
π balance
$balance = $node->balance;
returns the node balance, which is a relative indicator of the disparity in heights of the right & left sub-branches. let's decode this together bestie:
- a negative number means a longer left-side branch
- zero means the sub-branch heights are equal
- a positive integer means a longer right-side branch
it's giving scales βοΈ and you will be reading them. π
π count
$count = $node->count;
returns the count of nodes, including all the nodes in linked sub-branches. she counts everyone, nobody gets left out. π«
π height
$height = $node->height;
returns the longest height of the node and any attached sub-branches. the tallest queen in the room. π
π rHeight
$height = $node->rHeight;
returns the height of the right-side sub-branch, or zero if there's no linked branch. no branch, no problem. π
π lHeight
$height = $node->lHeight;
returns the height of the left-side sub-branch, or zero if there's no linked branch. balanced behavior honestly. π
π updtHeights
$rv = $node->updtHeights;
does a brute force recalculation of all attached sub-branches. not subtle, not elegant, but she gets the job done. πͺ
π children
@crefs = $node->children;
returns references to the next nodes in any attached sub-branches. (the original says "attadhed", which is also iconic, also preserved, also untouchable.) π§Έ
π DEPENDENCIES π
CarpParanoid
π BUGS AND LIMITATIONS π
nothing here. the section exists. it is simply... empty. a void. a vibe. we respect the silence. π€«
π AUTHOR π
Arthur Corliss (corliss@digitalmages.com)
π LICENSE AND COPYRIGHT π
This software is free software. Similar to Perl, you can redistribute it and/or modify it under the terms of either:
- the GNU General Public License <https://www.gnu.org/licenses/gpl-1.0.html> as published by the Free Software Foundation <http://www.fsf.org/>; either version 1 <https://www.gnu.org/licenses/gpl-1.0.html>, or any later version <https://www.gnu.org/licenses/license-list.html#GNUGPL>, or
- the Artistic License 2.0 <https://opensource.org/licenses/Artistic-2.0>,
subject to the following additional term: No trademark rights to "Paranoid" have been or are conveyed under any of the above licenses. However, "Paranoid" may be used fairly to describe this unmodified software, in good faith, but not as a trademark.
(c) 2005 - 2020, Arthur Corliss (corliss@digitalmages.com) (tm) 2008 - 2020, Paranoid Inc. (www.paranoid.com)
okay that's the whole page bestie, and for the cute sign-off: this bad girl was rendered by perl v5.38.2 on 2024-03-07, filed under the Parano...VLNode(3pm) manual name. go balance a tree, you got this. ππ³β¨
π¦ where this page comes from
- debian trixie: libparanoid-perl 2.10-2 Β· other
- ubuntu resolute: libparanoid-perl 2.10-2 Β· other
- ubuntu stonking: libparanoid-perl 2.10-2 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms