Main > Programming > Libraries >

Tree::Binary 0.07

Tree::Binary 0.07

Sponsored Links

Tree::Binary 0.07 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.027 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 1110
Date added: 2006-10-14
Publisher: Stevan Little

Tree::Binary 0.07 description

Tree::Binary is a Object Oriented Binary Tree for Perl.

SYNOPSIS

use Tree::Binary;

# a tree representaion of the expression:
# ((2 + 2) * (4 + 5))
my $btree = Tree::Binary->new("*")
->setLeft(
Tree::Binary->new("+")
->setLeft(Tree::Binary->new("2"))
->setRight(Tree::Binary->new("2"))
)
->setRight(
Tree::Binary->new("+")
->setLeft(Tree::Binary->new("4"))
->setRight(Tree::Binary->new("5"))
);
# Or shown visually:
# +---(*)---+
# | |
# +-(+)-+ +-(+)-+
# | | | |
# (2) (2) (4) (5)

# get a InOrder visitor
my $visitor = Tree::Binary::Visitor::InOrderTraversal->new();
$btree->accept($visitor);

# print the expression in infix order
print $visitor->getAccumulation(); # prints "2 + 2 * 4 + 5"

# get a PreOrder visitor
my $visitor = Tree::Binary::Visitor::PreOrderTraversal->new();
$btree->accept($visitor);

# print the expression in prefix order
print $visitor->getAccumulation(); # prints "* + 2 2 + 4 5"

# get a PostOrder visitor
my $visitor = Tree::Binary::Visitor::PostOrderTraversal->new();
$btree->accept($visitor);

# print the expression in postfix order
print $visitor->getAccumulation(); # prints "2 2 + 4 5 + *"

# get a Breadth First visitor
my $visitor = Tree::Binary::Visitor::BreadthFirstTraversal->new();
$btree->accept($visitor);

# print the expression in breadth first order
print $visitor->getAccumulation(); # prints "* + + 2 2 4 5"

# be sure to clean up all circular references
$btree->DESTROY();

This module is a fully object oriented implementation of a binary tree. Binary trees are a specialized type of tree which has only two possible branches, a left branch and a right branch. While it is possible to use an n-ary tree, like Tree::Simple, to fill most of your binary tree needs, a true binary tree object is just easier to mantain and use.

Binary Tree objects are especially useful (to me anyway) when building parse trees of things like mathematical or boolean expressions. They can also be used in games for such things as descisions trees. Binary trees are a well studied data structure and there is a wealth of information on the web about them.

This module uses exceptions and a minimal Design By Contract style. All method arguments are required unless specified in the documentation, if a required argument is not defined an exception will usually be thrown. Many arguments are also required to be of a specific type, for instance the $tree argument to both the setLeft and setRight methods, must be a Tree::Binary object or an object derived from Tree::Binary, otherwise an exception is thrown. This may seems harsh to some, but this allows me to have the confidence that my code works as I intend, and for you to enjoy the same level of confidence when using this module. Note however that this module does not use any Exception or Error module, the exceptions are just strings thrown with die.

This object uses a number of methods copied from another module of mine, Tree::Simple. Users of that module will find many similar methods and behaviors. However, it did not make sense for Tree::Binary to be derived from Tree::Simple, as there are a number of methods in Tree::Simple that just wouldnt make sense in Tree::Binary. So, while I normally do not approve of cut-and-paste code reuse, it was what made the most sense in this case.

Tree::Binary 0.07 Screenshot

Advertisements

Tree::Binary 0.07 Keywords

Bookmark Tree::Binary 0.07

Hyperlink code:
Link for forum:

Tree::Binary 0.07 Copyright

WareSeeker periodically updates pricing and software information of Tree::Binary 0.07 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Tree::Binary 0.07 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
Tree::Binary::Search is a binary search tree for Perl. Free Download
Tree::Visualize is a Perl module for visualizing Tree structures. Free Download
CVS Perl library is a Perl module which is is a wrapper around the CVS command with an object-oriented interface. Free Download
Convert::Binary::C is a Binary Data Conversion using C Types. Free Download
Bundle::Perl6 is a Perl bundle to install Perl6-related modules. Free Download
UML::Sequence is a Perl module to render UML sequence diagrams, often by running the code. Free Download
DateTime::Calendar::FrenchRevolutionary - dates in the French Revolutionary Calendar. Free Download
Test::Perl::Critic is a Perl module use Perl::Critic in test programs. Free Download