The library which helps developers to implement the data structures & algorithms easily without implementing everything.
Project description
easyDSI 1.2.0
Python Library makes it easy for users to code and run data structures & algorithms without having to summarize everything.
Contains
- heap()
- min_heap()
- max_heap()
- queue()
- tree()
- binary_tree()
- binary_search_tree()
Heap
- heap() or heap([list]) - Creates a min heap.
- min_heap() or min_heap([list]) - Creates a min heap.
- max_heap() or max_heap([list]) - Creates a max heap.
Methods
- add(element) - Add the element at the last position.
- remove() - Delete the element.
- get_max(n) - Get the n maximum elements from the heap.
- get_min(n) - Get the n minimum elements from the heap.
- display() - Display all the elements.
- get_elements() - Return all the elements.
Queue
- queue() or queue([list]) - Creates a queue.
Methods
- add(element) - Add the element at the last position.
- add(position, element) - Add the element at the position you give.
- add_first() - Add the element at the first position.
- add_last() - Add the element at the last position.
- remove() - Delete the element from the first position.
- remove(position) - Delete the element from the position.
- remove_first() - Remove the element from the first position.
- remove_last() - Remove the element from the last position.
- index(position) - Get the element from the position.
- find(element) - Get the index of the element.
- display() - Display all the elements.
- get_elements() - Return all the elements.
- get_size() - Get the total number of elements.
- get_max() - Get the maximum element from the queue.
- get_min() - Get the minimum element from the queue.
- get_sum() - Get the sum of the elements from the queue.
- get_avg() - Get the average of the elements from the queue.
- reverse(inplace=False) - Reverse the queue.
- sort(desc=False, inplace=False) - Sort the queue.
- map(function, inplace=False) - Map all the elements to the function.
Tree
- tree() or tree([list]) - Creates a binary tree.
- binary_tree() or binary_tree([list]) - Creates a binary tree.
- binary_search_tree() or binary_search_tree([list]) - Creates a binary search tree.
Methods
- add(element) - Add the element.
- remove(value) - Delete the element with the value.
- get_elements() - Return all the elements.
- get_nodes() - Return all the nodes.
- display() - Display all the elements.
- inorder() - Return the in-order traversal of the tree.
- preorder() - Return the pre-order traversal of the tree.
- postorder() - Return the post-order traversal of the tree.
- levelorder() - Return the level-order traversal of the tree.
- get_size() - Get the total number of elements.
- get_height() - Return the height of the tree.
- get_properties() - Return the properties of the tree.
How to install
- Open your command prompt and enter the below command.
pip install easydsi
How to use
- Import the library in your project.
import easydsi as dsi
- Initialize the data structure.
queue = dsi.queue([1, 2, 3])
queue.display()
[1, 2, 3]
- Add an element.
queue.add(4)
queue.display()
[1, 2, 3, 4]
- Remove an element.
queue.remove()
queue.display()
[1, 2, 3]
Change Log
1.2.1 (13/09/2022)
New Features:
- Binary Tree
- Binary Search Tree
- Min Heap
- Max Heap
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
easydsi-1.2.1.tar.gz
(15.1 kB
view details)
File details
Details for the file easydsi-1.2.1.tar.gz
.
File metadata
- Download URL: easydsi-1.2.1.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82f7bb215e0ec95f0a59b6c5eeaf20ab7ef2b17cfbd3afc8a1fc344a34a28d0c |
|
MD5 | 41d65492ac7b489af243d17d718de5b9 |
|
BLAKE2b-256 | c61fb8f8dedafb0a554eeb752b86f6f05e37da631815b689e4e3faa1812fe45f |