Implementation of various data structures in Python from scratch
Project description
data-structures-python
Data structures
In this library, we implemented some important data structures and seen how they work. We have:
-
Array_new: This was our custom implementation of an array. It provided a way to store a contiguous sequence of elements and likely included basic array operations like initialization and element access. We used it as one of the underlying structures for ourStackimplementation. -
Node: This class served as the fundamental building block for our linked list and tree implementations. EachNodeobject held avalueand references (nextand optionallyprevfor doubly linked lists,leftandrightfor trees) to other nodes in the data structure. -
LinkedList: This class implemented the linked list data structure, utilizingNodeobjects. It supported both singly and doubly linked lists and provided methods for inserting, deleting, accessing, searching, reversing, and updating elements within the list. We used it as the underlying structure for ourStackandQueueimplementations. -
Stack: This class implemented the stack data structure, which follows the LIFO principle. It could be initialized with either anArray_newor aLinkedListobject as its underlying storage. It provided methods forpush(to add elements to the top),pop_stack(to remove and return the top element),peek(to view the top element),isEmpty(to check if the stack is empty), anddisplay_stack(to show the stack's contents). -
Queue: This class implemented the queue data structure, following the FIFO principle. It used aLinkedListas its underlying storage. It provided methods forenqueue(to add elements to the rear),dequeue(to remove and return the front element),peek(to view the front element),rear(to view the rear element),isNull(to check if the queue is empty), anddisplay_queue(to show the queue's contents). -
BinaryTree: This class inherited from theNodeclass and represented a binary tree. Each instance was a node that could have a left and a right child. It included methods for different tree traversals (pre_order,in_order,post_order), searching for nodes (search_node,search_BSTfor Binary Search Trees), and adding nodes while maintaining the BST property (addnode). It also had methods for building and drawing a graph representation of the tree usingnetworkxandmatplotlib(build_graph,draw_graph).
In essence, these classes provide the blueprints and functionalities for creating and manipulating different types of data structures, each designed for specific ways of organizing and accessing data.
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 data_structures_py_jordankbm-0.1.0.tar.gz.
File metadata
- Download URL: data_structures_py_jordankbm-0.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6787f5a70592ad98a1c06e938a6808488616bac9277c9db89951a59aabde32fb
|
|
| MD5 |
e5e1779436017674e0c1d30d69016f2a
|
|
| BLAKE2b-256 |
6c6793f6bff3c343fd9780ffcfb7060f31c10c03433b3376781600b04b2f6b59
|
File details
Details for the file data_structures_py_jordankbm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: data_structures_py_jordankbm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d70065340a6e87d6bf95a7c7d835c253f2dcc7bc3286dbb99209030bb2e1ba5
|
|
| MD5 |
1978e8abf0f1213b1479246f067d3a31
|
|
| BLAKE2b-256 |
06256a3c56b0778abf9b3c5e74d18d26cf7afccac38a0d988fa5be456f8f47d0
|