Tree::BPTree 1.07
Sponsored Links
Tree::BPTree 1.07 Ranking & Summary
File size:
0.017 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
1212
Date added:
2006-07-04
Publisher:
Andrew Sterling Hanenkamp
Tree::BPTree 1.07 description
Tree::BPTree is a Perl implementation of B+ trees.
SYNOPSIS
use Tree::BPTree;
# These arguments are actually the defaults
my $tree = new Tree::BPTree(
-n => 3,
-unique => 0,
-keycmp => sub { $_[0] cmp $_[1] },
-valuecmp => sub { $_[0] <=> $_[1] },
);
# index the entries in this string:
my $string = "THERES MORE THAN ONE WAY TO DO IT"; # TMTOWTDI
my $i = 0;
$tree->insert($_, $i++) foreach (split //, $string);
# find the index of the first T
my $t = $tree->find(T);
# find the indexes of every T
my @t = $tree->find(T);
# We dont like the word WAY , so lets remove it
my $i = index $string, W;
$tree->delete($_, $i++) foreach (split //, substr($string, $i, 4));
# Reverse the sort order
$tree->reverse;
# Iterate through each key/value pair just like built-in each operator
while (my ($key, $value) = $tree->each) {
print "$key => $valuen";
}
# Reset the iterator when we quit from an "each-loop" early
$tree->reset;
# You might also be interested in using multiple each loops at once, which is
# possible through the cursor syntax. You can even delete individual pairs
# from the list during iteration.
my $cursor = $tree->new_cursor;
while (my ($key, $value) = $cursor->each) {
my $nested = $tree->new_cursor;
while (my ($nkey, $nvalue) = $nested->each) {
if ($key->shouldnt_be_in_this_tree_with($nkey)) {
$nested->delete;
}
}
}
# Iterate using an iterator subroutine
$tree->iterate(sub { print "$_[0] => $_[1]n" });
# Iterate using an iterator subroutine that returns the list of return values
# returned by the iterator
print join(, , $tree->map(sub { "$_[0] => $_[1]" })),"n";
# Grep-like operations
my @pairs = $tree->grep (sub { $_[0] =~ /S/ });
my @keys = $tree->grep_keys (sub { $_[0] =~ /S/ });
my @values = $tree->grep_values (sub { $_[0] =~ /S/ });
# Get all keys, values
my @all_keys = $tree->keys;
my @all_values = $tree->values;
# Clear it out and start over
$tree->clear;
B+ trees are balanced trees which provide an ordered map from keys to values. They are useful for indexing large bodies of data. They are similar to 2-3-4 Trees and Red-Black Trees. This implementation supports B+ trees using an arbitrary n value.
SYNOPSIS
use Tree::BPTree;
# These arguments are actually the defaults
my $tree = new Tree::BPTree(
-n => 3,
-unique => 0,
-keycmp => sub { $_[0] cmp $_[1] },
-valuecmp => sub { $_[0] <=> $_[1] },
);
# index the entries in this string:
my $string = "THERES MORE THAN ONE WAY TO DO IT"; # TMTOWTDI
my $i = 0;
$tree->insert($_, $i++) foreach (split //, $string);
# find the index of the first T
my $t = $tree->find(T);
# find the indexes of every T
my @t = $tree->find(T);
# We dont like the word WAY , so lets remove it
my $i = index $string, W;
$tree->delete($_, $i++) foreach (split //, substr($string, $i, 4));
# Reverse the sort order
$tree->reverse;
# Iterate through each key/value pair just like built-in each operator
while (my ($key, $value) = $tree->each) {
print "$key => $valuen";
}
# Reset the iterator when we quit from an "each-loop" early
$tree->reset;
# You might also be interested in using multiple each loops at once, which is
# possible through the cursor syntax. You can even delete individual pairs
# from the list during iteration.
my $cursor = $tree->new_cursor;
while (my ($key, $value) = $cursor->each) {
my $nested = $tree->new_cursor;
while (my ($nkey, $nvalue) = $nested->each) {
if ($key->shouldnt_be_in_this_tree_with($nkey)) {
$nested->delete;
}
}
}
# Iterate using an iterator subroutine
$tree->iterate(sub { print "$_[0] => $_[1]n" });
# Iterate using an iterator subroutine that returns the list of return values
# returned by the iterator
print join(, , $tree->map(sub { "$_[0] => $_[1]" })),"n";
# Grep-like operations
my @pairs = $tree->grep (sub { $_[0] =~ /S/ });
my @keys = $tree->grep_keys (sub { $_[0] =~ /S/ });
my @values = $tree->grep_values (sub { $_[0] =~ /S/ });
# Get all keys, values
my @all_keys = $tree->keys;
my @all_values = $tree->values;
# Clear it out and start over
$tree->clear;
B+ trees are balanced trees which provide an ordered map from keys to values. They are useful for indexing large bodies of data. They are similar to 2-3-4 Trees and Red-Black Trees. This implementation supports B+ trees using an arbitrary n value.
Tree::BPTree 1.07 Screenshot
Tree::BPTree 1.07 Keywords
BPTree
BPTree 1.07
Perl Implementation
0
trees
values
sub
t
keys
Tree::BPTree
TreeBPTree
Tree::BPTree 1.07
Libraries
Programming
Bookmark Tree::BPTree 1.07
Tree::BPTree 1.07 Copyright
WareSeeker periodically updates pricing and software information of Tree::BPTree 1.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::BPTree 1.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
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
Related Software
Bio::Tree::Tree is an Implementation of TreeI interface. Free Download
Tree::Binary is a Object Oriented Binary Tree for Perl. Free Download
Tree::XPathEngine is a re-usable XPath engine. Free Download
Tree::Numbered is a thin N-ary tree structure with a unique number for each item. Free Download
Tree::Binary::Search is a binary search tree for Perl. Free Download
CountYourEuro! project is a collaborative data collection project studying the distribution of EuroCoins. Free Download
ElegantJ Trees Bean package contains a feature-rich tree for hierarchical representation of data. Free Download
Markup::MatchTree is a Perl module for building trees to be compared to Markup::Trees. Free Download
Latest Software
Popular Software
Favourite Software