-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from warmachine028/v0.0.2
Added changes for V0.0.2
- Loading branch information
Showing
27 changed files
with
350 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,134 @@ | ||
# datastax | ||
updated: Friday, 17th December 2021 | ||
|
||
<div align=center> | ||
<a href="https://github.com/warmachine028/datastax"><img width=200 src="assets/icon.png" alt="datastax"></a> | ||
<p style="font-family: roboto, calibri; font-size:12pt; font-style:italic"> Simplicity meets intelligence</p> | ||
<a href="https://github.com/warmachine028/datastax/releases/"> <img src="https://img.shields.io/github/v/release/warmachine028/datastax?color=brightgreen"></a> | ||
<br> | ||
<a href="https://github.com/warmachine028/datastax/releases/tag/V4.2.1-beta"> <img alt="" src="https://img.shields.io/github/v/release/warmachine028/datastax?color=lightgreen&include_prereleases&label=pre%20release"> </a> | ||
<br> | ||
<img src="https://img.shields.io/github/stars/warmachine028/datastax"> | ||
<a href= "https://github.com/warmachine028/datastax/blob/main/LICENSE"><img src="https://img.shields.io/github/license/warmachine028/datastax?color=orange"></a> | ||
<a href="https://github.com/warmachine028/datastax/network/members"><img src="https://img.shields.io/github/forks/warmachine028/datastax?color=cyan"></a> | ||
</div> | ||
|
||
# [Datastax](https://github.com/warmachine028/datastax) | ||
|
||
## What's New? | ||
|
||
- Added terminal demo | ||
- Improved type hinting using mypy static type checker | ||
- Removed few bugs and potential errors | ||
- Purified test_structure | ||
- Improvised for uploading in PyPI | ||
|
||
## Table of Contents | ||
|
||
- [Introduction](#introduction) | ||
- [Problem Statement](#problem-statement) | ||
- [Benefits](#benefits) | ||
- [Requirements](#requirements) | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
|
||
## Introduction | ||
|
||
- This is a very simple yet powerful project to implement day to day data structures. | ||
- This is a very simple yet powerful project to implement day to day abstract data structures. | ||
- A pure implementation of Python in representing Trees and Linkedlists in basic command prompt | ||
|
||
- It helps visualize each data structure for better understanding | ||
- Students can be beneficial in using this Package | ||
- This project is still under construction | ||
|
||
## Problem Statement | ||
|
||
- Often in the beginning CS students face problems in understanding the internal architecture of ADTs | ||
- While solving coding challenges locally where test cases have to be written using these ADTs, it becomes really | ||
cumbersome to write these data structures from scratch. | ||
- Often while writing a programs implementing these ADS we encounter lots of errors just because we are unable to | ||
preview what's actually going on under the hood. | ||
|
||
## Benefits | ||
|
||
- Instant installation | ||
- Quick Updates | ||
- Very small size | ||
- No extra modules required | ||
- Written purely from scratch | ||
- Easy Documentation [Upcoming] | ||
- Command Line Demo | ||
|
||
## Requirements | ||
|
||
- Runs on latest Python 3.8+ | ||
- This Library requires no extra modules | ||
|
||
## Installation | ||
|
||
Use the python package manager [pip](https://pip.pypa.io/en/stable/) to install datastax. | ||
1. Clone this repository locally | ||
2. Reach base folder _datastax/_ | ||
3. Use the python package manager [pip](https://pip.pypa.io/en/stable/) to install datastax. | ||
|
||
```bash | ||
pip install datastax | ||
pip install . | ||
``` | ||
|
||
## Usage | ||
|
||
### Demo | ||
|
||
- To get a demo of the library use the following command | ||
- **Windows**: | ||
|
||
```bash | ||
> py -m datastax | ||
``` | ||
- **Unix based systems**: | ||
|
||
```bash | ||
$ python -m datastax | ||
``` | ||
- _Result_ | ||
```bash | ||
Available modules are: | ||
1. LinkedLists | ||
2. Trees | ||
|
||
Usage | ||
$ py datastax <data-structure> [data] | ||
Data Structures: | ||
trees Hierarchical DS | ||
linkedlists Linear DS | ||
``` | ||
- Then follow as the instruction guides | ||
|
||
```bash | ||
> py -m datastax linkedlist 1 2 3 4 | ||
Visuals for LinkedLists: | ||
|
||
1. Singly Linked List: | ||
Node[1] -> Node[2] -> Node[3] -> Node[4] -> NULL | ||
|
||
2. Doubly Linked List: | ||
NULL <-> Node[1] <-> Node[2] <-> Node[3] <-> Node[4] <-> NULL | ||
... | ||
``` | ||
|
||
### Practical Usage | ||
|
||
```py | ||
from datastax.trees import BinaryTree | ||
|
||
bt = BinaryTree([1, 2, 3, 4, 5]) | ||
print(bt) | ||
|
||
## OUTPUT: | ||
""" | ||
1 | ||
┌─────┴─────┐ | ||
2 3 | ||
┌──┴──┐ | ||
4 5 | ||
""" | ||
``` | ||
|
||
## Usage |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# __init__.py | ||
|
||
# Versioning of the datastax package | ||
__version__ = "0.0.2" | ||
__all__ = ['trees', 'linkedlists'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import sys | ||
|
||
from datastax import linkedlists as ll, trees | ||
|
||
|
||
def main(): | ||
if len(sys.argv) > 1: | ||
data_structure = sys.argv[1].lower() | ||
data = sys.argv[2:] if len(sys.argv) > 2 else [*range(5)] # take User given data or default | ||
if data_structure in ('linkedlist', "linkedlists"): | ||
print("Visuals for LinkedLists:\n\n" | ||
f"1. Singly Linked List: \n{ll.LinkedList(data)}\n\n" | ||
f"2. Doubly Linked List: \n{ll.DoublyLinkedList(data)}\n\n" | ||
f"3. Circular Linked List: \n{ll.CircularLinkedList(data)}\n\n" | ||
f"4. Doubly Circular List: \n{ll.DoublyCircularList(data)}\n\n") | ||
elif data_structure in ('tree', 'trees'): | ||
print("Visuals for Trees:\n\n" | ||
f"1. Binary Tree \n{trees.BinaryTree(data)}\n\n" | ||
f"2. Binary Search Tree \n{trees.BinarySearchTree(data)}\n\n" | ||
f"3. AVL Tree \n{trees.AVLTree(data)}\n\n") | ||
else: | ||
print("This module is not available yet") | ||
else: | ||
print("Available modules are:\n" | ||
"1. LinkedLists\n" | ||
"2. Trees\n" | ||
"\nUsage\n" | ||
"$ py datastax <data-structure> [data]\n" | ||
"Data Structures: \n" | ||
" trees Hierarchical DS\n" | ||
" linkedlists Linear DS") | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
from .circular_list import CircularLinkedList | ||
from .circular_linked_list import CircularLinkedList | ||
from .doubly_circular_list import DoublyCircularList | ||
from .doubly_linked_list import DoublyNode, DoublyLinkedList | ||
from .linked_list import LinkedList, Node | ||
|
||
__all__ = [ | ||
'LinkedList', 'Node', | ||
'DoublyLinkedList', 'DoublyNode', | ||
'CircularLinkedList', | ||
'DoublyCircularList' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
from .avl_tree import AVLTree, AVLTreeNode | ||
from .avl_tree import AVLTree, AVLNode | ||
from .binary_search_tree import BinarySearchTree | ||
from .binary_tree import BinaryTree, TreeNode | ||
|
||
__all__ = [ | ||
"BinaryTree", "TreeNode", | ||
"BinarySearchTree", | ||
"AVLTree", "AVLNode" | ||
] |
Oops, something went wrong.