| Robert Rothenberg 2004-03-19, 12:56 pm |
|
List::SkipList v0.40 has been uploaded and should begin appearing on
CPAN mirrors near you.
From the README:
NAME
List::SkipList - Perl implementation of skip lists
REQUIREMENTS
Perl 5.6.1 is required.
"Carp::Assert" is used for validation and debugging. (The assertions can
be commented out if the module cannot be installed.) Otherwise standard
modules are used.
SYNOPSIS
my $list = new List::SkipList();
$list->insert( 'key1', 'value' );
$list->insert( 'key2', 'another value' );
$value = $list->find('key2');
$list->delete('key1');
DESCRIPTION
This is an implementation of skip lists in Perl. What are "skip
lists"? From WikiPedia <http://en.wikipedia.org/wiki/Skip_list>:
Skip lists are a probabilistic data structure that seem likely
to supplant balanced trees as the implementation method of
choice for many applications. Skip list algorithms have the same
asymptotic expected time bounds as balanced trees and are
simpler, faster and use less space.
(This particular implementation may not necessarily be faster or
use less space, but in superficial testing, it does appear to be a
reasonably faster substitute for some tree modules.)
Skip lists are similar to linked lists, except that they have
random links at various levels that allow searches to skip over
sections of the list, like so:
4 +---------------------------> +----------------------> +
| | |
3 +------------> +------------> +-------> +-------> +--> +
| | | | | |
2 +-------> +--> +-------> +--> +--> +--> +-------> +--> +
| | | | | | | | |
1 +--> +--> +--> +--> +--> +--> +--> +--> +--> +--> +--> +
A B C D E F G H I J NIL
A search would start at the top level: if the link to the right
exceeds the target key, then it descends a level.
More information is available in the module documentation.
REVISION HISTORY
Changes since v0.33:
0.40 Wed Mar 17 2004
- added Benchmark file to distribution
* key_cmp now ignores when key is undefined
- _insert returns the value of $node->key_cmp($key)
- broke up test cases into separate files
- added finger caching to speed up sequential inserts
- fixed bugs with values, keys, copy, merge, first_key and next_key
methods related to use of search fingers
- fixed bug with append method
- fixed bug with search fingers: they were not being used
- _debug now prints to STDERR
* reset method is not called when a new node is added or deleted
(which is in accord with documentation)
- stub for next method added
- List::SkipList::Node ignores invalid and extra arguments
- minor optimizations in List::SkipList and List::SkipList::Node
- improved speed of _random_level
- disabled assertions (for 50% speed improvement!)
- inserted corrected comment in README about actual performance in
comparison to trees
A detailed revision history is in the Changes file included with
this distribution.
AUTHOR
Robert Rothenberg <rrwo at cpan.org>
LICENSE
Copyright (c) 2003-2004 Robert Rothenberg. All rights reserved. This
program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
|