DataStructure
Collection of useful data-structures in pure Perl.
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.
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).
Note that you should never directly test the
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).
$obj-
DOES
isa
Implemented by DataStructure::LinkedList and DataStructure::DoubleList
Has the following methods shift(), push($value), values(), empty(), size().
shift()
push($value)
values()
empty()
size()
Nodes have the following methods: value().
value()
Synonym: DataStructure::FIFO.
DataStructure::FIFO
Implemented by DataStructure::LinkedList (with the reverse option) and DataStructure::DoubleList.
reverse
Has the following methods first(), push($value), pop(), values(), empty(), size().
first()
pop()
Nodes have the following methods: value(), insert_after($value), next().
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.
shift
unshift
Stack
Synonym: DataStructure::LIFO.
DataStructure::LIFO
Implemented by DataStructure::BTree
Has the following methods insert($value), find($value), delete($value | $node), values(), empty(), size().
insert($value)
find($value)
delete($value | $node)
Mathias Kende <mathias@cpan.org>
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.
To install DataStructure, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DataStructure
CPAN shell
perl -MCPAN -e shell install DataStructure
For more information on module installation, please visit the detailed CPAN module installation guide.