The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Algorithm::SkipList::Node - node class for Algorithm::SkipList

REQUIREMENTS

The following non-standard modules are used:

  enum

DESCRIPTION

Methods are documented below.

new
  $node = new Algorithm::SkipList::Node( $key, $value, $header );

Creates a new node for the list. The parameters are optional.

Note that the versions 0.42 and earlier used a different calling convention.

key
  $key = $node->key;

Returns the key.

Note that as of version 0.70, this method is read-only. We should not change the key once a node has been added to the list.

key_cmp
  if ($node->key_cmp( $key ) != 0) { ... }

Compares the node key with the parameter. Equivalent to using

  if (($node->key cmp $key) != 0)) { ... }

without the need to deal with the node key being undef.

By default the comparison is a string comparison. If you need a different form of comparison, use a custom node class.

value
  $value = $node->value;

Returns the value of a node.

  $node->value( $value );

When used with an argument, sets the value.

  $header_ref = $node->header;

Returns the forward list array of the node. This is an array of nodes which point to the node returned, where each index in the array refers to the level.

Note that as of List::SkipList version 0.70, this method is read-only. Since it only returns header references (as of version 0.50), that reference can be used to modify forward pointers.

level
  $levels = $node->level;

Returns the number of levels in the node.

AUTHOR

Robert Rothenberg <rrwo at cpan.org>

Suggestions and Bug Reporting

Feedback is always welcome. Please use the CPAN Request Tracker at http://rt.cpan.org to submit bug reports.

LICENSE

Copyright (c) 2003-2005 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.

SEE ALSO

  Algorithm::SkipList