MySKL is a small library that implements a skip list data
structure (SKL) by means of that we can implement a fast kind of
lists, much faster than simple linked lists (SLL). Besides, pretty
much anything possible with SLL can be done as well using SKL.
In a such data structure, primary operations such as insertion,
deleting and searching, have almost the same complexity as in AVL
trees, but the former is easier to implement and thus maintain.
Any advice or constructive criticism is greatly
appreciated
Mail:
ghangenit[AT]users.sourceforge.net
Short brief of MySKL - download
here
================================
-
I decided to publish this small standalone library - that is a tiny
part of a more wide-breath project concerning Gis Data Structures -
since could be useful to someone, maybe only as a didatic example:
it uses a good and fast random number generator (Mersenne Twister),
an internal tracing/debugging system - Fred Fish's debugging library
- etc
-
It is written in C, compatible with C++ and compilable both
under Linux and Windows. It can be either compiled as a shared
or static library on Linux ( using "./configure; make; make install" )
or as a DLL on Windows ( i.e. launching an instance of Visual Studio).
Library was developed under Linux: support for compilation on Windows
was added later and is a bit less complete
-
It manages memory with care: no memory leaks found while using
Valgrind to test. With just one call to a MySKL function, all
lists created are also easily destroyed. Since data may be shared
among two or more lists (this often happens when we represent data
as pointers to objects), there needs to be a way to prevent repeated
calls for freeing memory on the same object
-
It represents data as a couple <key-item>. Item represents
the actual data to be inserted ( what we want to store ), while key
selects the position where inserting in the list. In this way, we can
also represent a list of not ordered item, using keys to mark the order
(thus the position) of insertion. Without keys, since a skip list is an
ordered list, item would be (one way or the other, depending on their type)
automatically ordered
-
It can deal with generic data types and support double linked lists.
By default, this kind of support is not enabled as the amount of
memory requested would be greater compared to single linked lists
-
MySKL includes an executable file - created during compilation that aims
to show an example of the MySKL usage and, besides, works as a test for
the lib, even though it does not guarantee at all from the absence of bugs :-(
-
A man file page,
along with some html files, are provided in the 'doc' dir. The last
ones describe the interface and a bit of the structures used for
implementing the library
-
MySKL provides about 34 methods: two of these are also useful to check the
result of some operations: one prints the skiplist in the form of memory
addresses, the other displaies a list as it would be if we put it down on
paper