Question: PYTHON Write a container class called PostitvePriorityQueue. The class should support methods: Constructor: Initializes the queue insert(): Takes a number as input and adds it

PYTHON

Write a container class called PostitvePriorityQueue. The class should support methods: Constructor: Initializes the queue insert(): Takes a number as input and adds it to the container. Does not allwo negitive numbers and raises an error if a negative number attempted.

PYTHON Write a container class called PostitvePriorityQueue. The class should support methods:

Write a container class called PostitvePriorityQueue. The class should support methods Constructor: Initializes the queue insert(): Takes a number as input and adds it to the container. Does not allwo negitive numbers and raises an error if a negative number attempted . min): Returns the smallest number in the container . removeMin): Removes the smallest number in the container removeMax(): Removes the largest number from the container isEmpty(): Returns True if container is empty, False otherwise . clear): remove all items from the container . . If a negative number is added. A Custom exception is raised named "NegativeNumberError" The overloaded operator len() and an iterator should also be supported -PositivePriorityQueue (1 insert (10) >>> q.insert (20) a.insert (30) >naert(-30) Traceback (most recent cal11 1ast) g.insert (-30 242\CSC 242 Dayweek 5\Solutions\cac242assi Fil. "C:\User \azokot Desktop\CSC gns-solutions . py", . line 6, 1n insert raise NegativellumberError Negativetlumbertzzor .min >>g.removeMiN 1sEmpty print () 20 30 >>>len(a) 9S

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!