Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the LLQueue.py file you created above that allows protity entities to be moved to the front of the queue. Write a unique test program

Modify the LLQueue.py file you created above that allows protity entities to be moved to the front of the queue. Write a unique test program that regular nodes and priority nodes to be added to and removed from queue.A priority queue is a queue that allows certain entities to be moved to the front of the queue. For example, in an emergency room, if somesone comes in with severe injury or illness, they are moved to the front in order to be treated before the others already in the queue.

Note: Class function for Node and ILLStack function is below:

class Node: def __init__(self,initdate): self.data=initdata self.next=None def getData(self,data): return self.data def getNext(self): return self.next def setData(self,newData): self.data=newData def setNext(self,newnext): self.next=newnext

class LLStack: def __init__(self): self.head=None def isEmpty(self): return self.head==None def push(self,item): temp=Node(item) temp.setNext(self.head) self.head=temp def pop(self): item=self.head.getData() self.head=self.head.getNext() return item def length(self): current=self.head count=0 while current!=None: count+=1 current=current.getNext() return count def printList(self): current=self.head while current!=None: print(current.getData(),end=" ") current=current.getNext() print()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions