NAME

DataStructure

SYNOPSIS

Collection of useful data-structures in pure Perl.

DESCRIPTION

This package is only here to define a common version for all the data-structure in this distribution and to contain the core documentation. Please refer to the documentation of the individual data-structure for more details.

DATA-STRUCTURE IMPLEMENTATIONS

These classes are actual implementations of data-structure. You should use them to create objects but, in general, you should then only expect object of a particular role (see below).

DataStructure::DoubleList
DataStructure::LinkedList

Note that you should never directly test the

ROLES

Roles, or data-structure interfaces, are

In DataStructure, the role are only implemented using normal Perl classes inheritence. So you can test that an object has a particular role with $obj-DOES('DataStructure::RoleName')> (you should use DOES and not isa as the library might use another system in the future).

DataStructure::Queue

Implemented by DataStructure::LinkedList and DataStructure::DoubleList

Has the following methods shift(), push($value), values(), empty(), size().

Nodes have the following methods: value().

Synonym: DataStructure::FIFO.

DataStructure::Stack

Implemented by DataStructure::LinkedList (with the reverse option) and DataStructure::DoubleList.

Has the following methods first(), push($value), pop(), values(), empty(), size().

Nodes have the following methods: value(), insert_after($value), next().

Note that, without the reverse option a DataStructure::LinkedList can also behave like a stack but you would need to use the less common shift and unshift pair of methods. In that case, it will not have the Stack role.

Synonym: DataStructure::LIFO.

DataStructure::OrderedSet

Implemented by DataStructure::BTree

Has the following methods insert($value), find($value), delete($value | $node), values(), empty(), size().

AUTHOR

Mathias Kende <mathias@cpan.org>

LICENCE

Copyright 2021 Mathias Kende

This program is distributed under the MIT (X11) License: http://www.opensource.org/licenses/mit-license.php

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.