This module is build for all those working professionals/students who have basic knowledge of Data Structures and want to save coding time,this module contains various single LinkedList,stack,queue operations.It also contains 5 sorting algorithms and 2 searching algorithms.
Linked List Operations
from data_structure.linkedlist import create,traversal,insertAtEnd,insertBegin,insertMiddle
#Methods to create and Traverse Linked List
create("Hi") #To create node,creates one node at a time
create("How")
create("Are")
create("You")
traversal() #To traverse Linked List
Output:
Hi->How->Are->You->None
#Methods to Insert in Linked List
insertBegin("Hey,") #Insert at Beginning
traversal()
output:
Hey,->Hi->How->Are->You->None
insertMiddle(2,"Bro") #First parameter takes position,second parameter takes data
traversal()
output:
Hey,->Hi->Bro->How->Are->You->None
insertAtEnd("Doing") #Inserting at end
traversal()
output:
Hey,->Hi->Bro->How->Are->You->Doing->None
Stack Operations
from data_structure.stack import Stack
s = Stack()
#To push element in stack
s.push(50)
output:
'50 pushed'
s.push(80)
output:
'80 pushed'
#To peek the stack
s.peek()
output:
80
#To pop elements in stack
s.remove()
output:
80
Queue Operations
from data_structure.queue import Queue
q=Queue()
#To insert elements into queue
q.insert(40)
output:
'40 inserted'
q.insert(50)
output:
'50 inserted'
#To remove elements from queue
q.remove()
output:
40
#To check size of Queue
q.size()
output:
1
Sorting Operations
This module contains 5 sorting algorithms which are:
1)bubbleSort.
2)mergeSort.
3)insertionSort.
4)shellSort.
5)selectionSort.
from data_structure.sort import mergeSort,bubbleSort,insertionSort,shellSort,selectionSort
sort = mergeSort([5,101,35,121,55,75])
print(sort)
output:
[5, 35, 55, 75, 101, 121]
sort = selectionSort([5,101,35,121,55,75])
print(sort)
output:
[5, 35, 55, 75, 101, 121]
Searching Operations
from data_structure.search import linearSearch,binarySearch
#Linear Search
search = linearSearch([5,101,35,121,55,75],121)
print(search) S #Binary Search, Note list passed should be sorted
search = binarySearch([5, 35, 55, 75, 101, 121],121)
print(search)
output:
Found 121 at index 5
Metadata
Release files for DataStructures15 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| DataStructures15-0.0.1.tar.gz | 5.3 kB | Without provenance | Details for DataStructures15-0.0.1.tar.gz |
Release files / DataStructures15-0.0.1.tar.gz
| Download URL | DataStructures15-0.0.1.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c3d1e63324f1ccafcb9ea1e87f605e7b7c6db143d59e701158df2b00de07dc9
|
|
BLAKE2b-256 checksum How to use checksums |
1b1228189d30d4793f98672532becead6aebde7488677380de24cefda596b59e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.4rc1
|
Security for DataStructures15 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.