Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pod::abstract::tree(3pm) [debian man page]

Pod::Abstract::Tree(3pm)				User Contributed Perl Documentation				  Pod::Abstract::Tree(3pm)

NAME
Pod::Abstract::Tree - Manage a level of Pod document tree Nodes. DESCRIPTION
Pod::Abstract::Tree keeps track of a set of Pod::Abstract::Node elements, and allows manipulation of that list of elements. Elements are stored in an ordered set - a single node can appear once only in a single document tree, so inserting a node at a point will also remove it from it's previous location. This is an internal class to Pod::Abstract::Node, and should not generally be used externally. METHODS
detach $tree->detach($node); Unparent the $node from $tree. All other elements will be shifted to fill the empty spot. push Add an element to the end of the node list. pop Remove an element from the end of the node list. insert_before $tree->insert_before($target,$node); Insert $node before $target. Both must be children of $tree insert_after $tree->insert_after($target,$node); Insert $node after $target. Both must be children of $tree unshift Remove the first node from the node list and return it. Unshift takes linear time - it has to relocate every other element in id_map so that they stay in line. children Returns the in-order node list. index_relative my $node = $tree->index_relative($target, $offset); This method will return a node at an offset of $offset (which may be negative) from this tree structure. If there is no such node, undef will be returned. For example, an offset of 1 will give the following element of $node. AUTHOR
Ben Lilburne <bnej@mac.com> COPYRIGHT AND LICENSE
Copyright (C) 2009 Ben Lilburne This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-01-03 Pod::Abstract::Tree(3pm)

Check Out this Related Man Page

RedBlack(3pm)						User Contributed Perl Documentation					     RedBlack(3pm)

NAME
Tree::RedBlack - Perl implementation of Red/Black tree, a type of balanced tree. SYNOPSIS
use Tree::RedBlack; my $t = new Tree::RedBlack; $t->insert(3, 'cat'); $t->insert(4, 'dog'); my $v = $t->find(4); my $min = $t->min; my $max = $t->max; $t->delete(3); $t->print; DESCRIPTION
This is a perl implementation of the Red/Black tree algorithm found in the book "Algorithms", by Cormen, Leiserson & Rivest (more commonly known as "CLR" or "The White Book"). A Red/Black tree is a binary tree which remains "balanced"- that is, the longest length from root to a node is at most one more than the shortest such length. It is fairly efficient; no operation takes more than O(lg(n)) time. A Tree::RedBlack object supports the following methods: new () Creates a new RedBlack tree object. root () Returns the root node of the tree. Note that this will either be undef if no nodes have been added to the tree, or a Tree::RedBlack::Node object. See the Tree::RedBlack::Node manual page for details on the Node object. cmp (&) Use this method to set a comparator subroutine. The tree defaults to lexical comparisons. This subroutine should be just like a comparator subroutine to sort, except that it doesn't do the $a, $b trick; the two elements to compare will just be the first two items on the stack. insert ($;$) Adds a new node to the tree. The first argument is the key of the node, the second is its value. If a node with that key already exists, its value is replaced with the given value and the old value is returned. Otherwise, undef is returned. delete ($) The argument should be either a node object to delete or the key of a node object to delete. WARNING!!! THIS STILL HAS BUGS!!! find ($) Searches the tree to find the node with the given key. Returns the value of that node, or undef if a node with that key isn't found. Note, in particular, that you can't tell the difference between finding a node with value undef and not finding a node at all. If you want to determine if a node with a given key exists, use the node method, below. node ($) Searches the tree to find the node with the given key. Returns that node object if it is found, undef otherwise. The node object is a Tree::RedBlack::Node object. min () Returns the node with the minimal key. max () Returns the node with the maximal key. AUTHOR
Benjamin Holzman <bholzman@earthlink.net> SEE ALSO
Tree::RedBlack::Node perl v5.10.0 2008-07-31 RedBlack(3pm)
Man Page