DSA using Python Tutorials
Program 1 # Static implementation of Queue import os MAXSIZE=10 rear=-1 front=-1 myqueue=[] # Queue def myinsert(): global rear global front global MAXSIZE if(rear==MAXSIZE-1): print(“Queue is oeverflow”) else: n=int(input(“Enter an element: “)) if(rear==-1 and...
Program 1 # Queue implementation using list myqueue=[] # Queue def qinsert(): n=int(input(“Enter an element: “)) myqueue.append(n) def qdelete(): if(len(myqueue)==0): print(“Queue is empty”) else: print(“Deleted element is: “,myqueue[0]) del myqueue[0] def qdisplay(): if(len(myqueue)==0): print(“Queue...
Program 1 # Queue implementation using collections from collections import deque class MyQueue: def __init__(self): self.queue=deque() def qinsert(self): n=int(input(“Enter an element for insert”)) self.queue.append(n) def qdelete(self): if(len(self.queue)==0): print(“Queue is empty”) else: print(“Deleted element is:...
Program 1 # implementation of circular queue import os MAXSIZE=10 cqueue=[] front=-1 rear=-1 def cqinsert(): global rear global front global MAXSIZE if(((rear+1)%MAXSIZE)==front): print(“Queue is overflow”) else: n=int(input(“Enter an element for insert”)) if(front==-1 and rear==-1):...
Program 1 # Stack Implementation stack=list() def push(): n=int(input(“Enter element in stack:”)) if(len(stack)==0): stack.append(n) else: stack.insert(0,n) def pop(): if(len(stack)==0): print(“Stack is empty”) else: print(“Poped element is:”,stack[0]) del stack[0] def display(): if(len(stack)==0): print(“Stack is empty”)...
Program 1 # Project: Family Tree Builder (Based on BT and Linked list) # Objective: # To create a basic system that allows users to build, manage, and # explore a family tree structure,...
Program 1 # Project: Traffic Light Simulation Using Queue Linked List # ———————————————————- # Features: # Add vehicles to queue (simulating arrival) # Process vehicles when the signal turns green # Show vehicles in...
Program 1 # Project: Restaurant Order Processing System(Based on Doubly linked list and DQUEUE) # Features: # 1. Add order at the end of the queue (new order) # 2. Serve the first order...
Program 1 # Movie Ticket Booking System ( Based on 2 D Array) class Seat: def __init__(self): self.booked = False self.name = “” class MovieTheater: ROWS = 5 COLS = 10 def __init__(self): self.seats...
Program 1 # Music Play list based on Doubly Linked List class Song: # Node of doubly linked list def __init__(self, title): self.prev = None self.title = title self.next = None class MusicPlaylist: def...