Skip to main content

Data structure components module

Project description

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) #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


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

DataStructures10-1.0.1.tar.gz (5.2 kB view details)

Uploaded Source

File details

Details for the file DataStructures10-1.0.1.tar.gz.

File metadata

  • Download URL: DataStructures10-1.0.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for DataStructures10-1.0.1.tar.gz
Algorithm Hash digest
SHA256 17879b40b0f427c17fd6119ab07c8fad3c28749f0393e4944ab6b7949b808877
MD5 e72a37500f085f75f6b53533db29a2dd
BLAKE2b-256 783558dfb9338e4b4945b3a5a63328c886a5e2d347f58558ce98f54e27a3b725

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page