DSA using Python Tutorials

Searching in Linked List in DSA Python 0

Searching in Linked List in DSA Python

Program 1 # Impelmentation of Single Linked List # class for size of Node class Node: def __init__(self): self.data=None self.add=None class LinkedList: def __init__(self): self.start=None self.count=0 #method for create list def createList(self): n=int(input(“Enter an...

Deletion in Linked List in DSA Python 0

Deletion in Linked List in DSA Python

Program 1 # Impelmentation of Single Linked List # class for size of Node class Node: def __init__(self): self.data=None self.add=None class LinkedList: def __init__(self): self.start=None self.count=0 #method for create list def createList(self): n=int(input(“Enter an...

Insertion in Linked List in DSA Python 0

Insertion in Linked List in DSA Python

 Program 1 # Impelmentation of Single Linked List # class for size of Node class Node: def __init__(self): self.data=None self.add=None class LinkedList: def __init__(self): self.start=None self.count=0 #method for create list def createList(self): n=int(input(“Enter an...

Queue using List in DSA Python 0

Queue using List in DSA Python

Program 1 #Queue implementation using List queue=[] # empy list def qinsert(): n=int(input(“Enter an element for insert”)) queue.append(n) def qdelete(): if(len(queue)==0): print(“Queue is empty”) else: print(“Deleted element is: “,queue[0]) del queue[0] def qdisplay(): if(len(queue)==0):...

Priority Queue using List in DSA Python 0

Priority Queue using List in DSA Python

Program 1 # Implementation of priority queue using list pq=[] #empty list def qinsert(): n=int(input(“Enter an element”)) pq.append(n) def qdelete(): if(len(pq)==0): print(“Priority Queue is empty”) else: pq.sort() print(“Deleted element is: “,(pq[0])) del pq[0] def...

Deque using Collection Module in DSA Python 0

Deque using Collection Module in DSA Python

Program 1 #implementation of DQueue using collections import collections mydq=collections.deque() # insert Rear function def insertRear(): n=int(input(“Enter an element”)) mydq.append(n) # Delete Front function def deleteFront(): if(not mydq): print(“Queue is empty”) else: print(“Delete element...

Linear Queue using Collection Module in DSA Python 0

Linear Queue using Collection Module in DSA Python

Program 1 #imlementation of liner queue import collections myqueue=collections.deque() #insert function def qinsert(): n=int(input(“Enter an element for insert”)) myqueue.append(n) #delete function def qdelete(): if(not myqueue): print(“Queue is empty”) else: print(“Deleted element is: “,myqueue.popleft()) #display...

Stack using Collection Module in DSA Python 0

Stack using Collection Module in DSA Python

Program 1 import collections stack=collections.deque() while(1): print(“\n—————————-Stack Menu——————-\n”) print(“1.Push\n2.Pop\n3.Display\n4.Exit “) print(“\n————————————————————\n”) choice=int(input(“Enter your choice”)) if(choice==1): n=int(input(“Enter an element for push”)) stack.append(n) elif(choice==2): if(not stack): print(“Stack is empty”) else: print(“Poped element:”,stack.pop()) elif(choice==3): if(not stack): print(“Stack...