A pedagogical Python package implementing core data structures from scratch
Project description
Ejah Data Structures Python Package
Ejah Data Structures is a Python package that provides various data structures with common operations such as insert, delete, search, and traverse. This package includes implementations of the following data structures: Array, Binary Search Tree, Binary Graph Search, Singly Linked List, Queue, and Stack.
Installation
To install the Ejah Data Structures Python package, ensure you have Python installed on your system. You can install the package using pip:
pip install ejah-data-structures
Make sure you run this command within a Python environment.
Clone the Repository
To clone this repository to your local machine, follow these steps:
-
Run the following command on your terminal to clone the repository:
git clone https://github.com/EjahDil/data-structures-python.git
-
Navigate into the project directory:
cd data-structures-python
Features
This package includes the following data structures, each with its own module containing methods for insert, delete, search, traverse, and more:
Array
The Array class provides a dynamic array implementation with operations to insert, delete, search, and traverse the array.
Methods
- Insert(index, value): Adds an element at a specified index.
- Delete(index): Removes an element from a given index.
- Search(value): Searches for an element and returns its index.
- Traverse(): Returns all elements in the array.
- Length(): Returns the number of elements in the array.
- Is Empty(): Checks if the array is empty.
Binary Graph Search
The BinaryGraphSearch class allows for binary search on a sorted list of data. This class implements both the search operation and the insert operation to maintain the list in sorted order.
Methods
- Search(target): Searches for a target element using binary search.
- Insert(value): Inserts a value into the list while maintaining the sorted order.
- In-order Traversal(): Simulates an in-order traversal of the binary tree (which is essentially the sorted list).
Binary Search Tree
The BinarySearchTree class implements a binary search tree, which allows for efficient searching, insertion, and traversal of nodes in sorted order.
Methods
- Insert(data): Inserts a node with the given data.
- Search(data): Searches for a node with the specified data.
- In-order Traversal(): Returns the nodes in sorted order (in-order traversal).
Singly Linked List
The SinglyLinkedList class provides a basic singly linked list implementation.
Methods
- Insert(data): Adds a new node at the end of the list.
- Delete(data): Removes a node with the specified value.
- Search(data): Searches for a node containing a specific value.
- Traverse(): Returns a list of all nodes' data.
Queue
The Queue class implements a FIFO (First-In-First-Out) structure, which is useful for scenarios like task scheduling.
Methods
- Enqueue(item): Adds an item to the end of the queue.
- Dequeue(): Removes and returns the front item from the queue.
- Peek(): Returns the front item without removing it.
- Is Empty(): Checks if the queue is empty.
Stack
The Stack class implements a LIFO (Last-In-First-Out) structure, which is essential for undo operations, function calls, and parsing expressions.
Methods
- Push(item): Adds an item to the top of the stack.
- Pop(): Removes and returns the top item from the stack.
- Peek(): Returns the top item without removing it.
- Is Empty(): Checks if the stack is empty.
Usage After installation, you can start using the package by importing the classes directly into your Python code.
Usage
After installation, you can start using the package by importing the classes directly into your Python code.
from ejah_data_structures import Array, Queue, Stack, SinglyLinkedList, BinaryGraphSearch, BinarySearchTree
Documentation
For detailed usage and installation instructions, please refer to the documentation.
You can find examples, code explanations, and additional information on how to use the package in the documentation.
Contribute
If you'd like to contribute to this project, please visit the GitHub repository and submit issues, pull requests, or suggestions.
Feel free to fork the project and make improvements or add new features to enhance its usefulness.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ejahdilandatastruct-0.1.1.tar.gz.
File metadata
- Download URL: ejahdilandatastruct-0.1.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c14fdc95a2c44e7700849971d91c2c9fb14a0cacb59cf4bc3857c1d78f11403c
|
|
| MD5 |
f82ee7c169b1c2f6147cb19044627bc4
|
|
| BLAKE2b-256 |
509a5f41d6c99780fc36072afde4feee2f8fa6f92e89dac027741105c5ea0a10
|
File details
Details for the file ejahdilandatastruct-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ejahdilandatastruct-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74d03f2d41681e6ad17e64a4a7678391860d93cb83827d6d7fc3012d09af6a81
|
|
| MD5 |
1d633045810ea911b4e8636d50f81c14
|
|
| BLAKE2b-256 |
c3f1316147ad755ebb586eb692ddaaeae79fcd84fcdb9c2401c6bfaaec76c709
|