Struct Pie

Struct Pie (A Pie of Structures)

Struct Pie is a free open source project under MIT license. The project is both a python library and a set of C shared libraries.

Github link: https://github.com/MNoorFawi/struct-pie

Python Library

The python library is a set of modules for data structures. All data structures are written in C and imported into python using cython. No python code involved to make the data structure pretty fast.

The idea is to extend python data structures to add more flexibility and to include more data structures that can help in different situations.

Library can be installed using pip command as follows:

pip install structpie

For a quick start, you can have a look at https://minimatech.org/struct-pie-quick-start/

C Shared Libraries

The C shared libraries project is available on sourceforge.net and contains the data structures as C shared libraries that can readily be used in C projects. The libraries can be downloaded from here.

LIFO & FIFO Stack, Binary Search Tree, Priority Queue and a Hash Table are implemented and included in this project. While future releases will have many other data structures.

The hash table uses separate chaining to avoid collision. In the “hash_table” directory, the hash table implementation uses linked lists.

While in “HashBSTree” directory, a hash table with a binary tree in each index is implemented for faster lookup in large data.

The stack, the tree and the hash table accept int, float and char* data type.

Each data structure has an example program and a README file to demonstrate the features of the library, along with an almost ready Makefile that may need a little tweaking to build the libraries on a certain operating system

For a full use case for one of the libraries available in Struct Pie, have a look at https://minimatech.org/task-scheduler-in-c-using-struct-pie/

Share

Leave a Reply

Your email address will not be published. Required fields are marked *