Question: hi, please modify the uncompleted python program. please provide complete code for this question. and also the last short writing question also their. please write





hi, please modify the uncompleted python program. please provide complete code for this question. and also the last short writing question also their. please write a answer to that too. thanks alot !!!
A2B1 (10 marks) Develop a Stack-based Queue having an internal Stack field, with the given Python file A2B1.py. In our lecture notes, the sample Queue is implemented with Linked-List approach (with internal fields head and tail nodes). In this task, we need to re-implement the Queue ADT with another approach, a queue data type having an internal field inStack of Stack type, only accessing the interface (operations) of the Stack. - Treating data at TOP of Stack as FRONT of Queue; Bottom of Stack as REAR of Queue * Useful hint: student may try to use two stacks to simulate a queue behaviour. External: A Queue (behaviour) Internal: Use Stack to hold and access data Write a Python program, with the given Python files. Complete the Stack-based Queue based on Queue ADT, by modifying our given file A2B1.py Extra Operations (methods of the class) to be implemented by Students: * ONLY access the interface (methods) of the given Stack data type. * DO NOT access the internal fields of the given stack, such as pList, top and capacity. At least one line of simple comment for each extra operation required Sample console display output of executing the main testing program MA2B1.pY ..- 1. New QueueS created -.. >> Queue Display, (REAR/Left to FRONT/Right) ... AN EMPTY QUEUE -- - 2. ENQueued: A,B,C-. > Queue Display, (REAR/Left to FRONT/Right) >C>B>A 2.1 reverseQ once -- > Queue Display, (REAR/Left to FRONT/Right) >A>B>C 2.2 reverseQ twice BACK --- Queue Display, (REAR/Left to FRONT/Right) >C>B>A -.- 3. DEQueued: elt is: A > Queue Display, (REAR/Left to FRONT/Right) >C>B peek(), front elt is B --- 4. ENQueued: D, then DEQueued: elt is: B > Queue Display, (REAR/Left to FRONT/Right) >D>C sezf.instack.displays() print() HAt H simple comment HERE def peek (seti): pass \# TO BE DONE BY STUDENT def dequeue (seif): H inethod, remove and return front elt pass \# TO BE DONE BY STUDENT def reverseg(self): \# method, reverse the internal fiezd instack pass \# TO BE DONE BY STUDENT def enqueue(self, invalue): \# method, insert to tail / rear pass \# TO BE DONE BY STUBEIT Questions: Answer the following questions based on your Python code developed in A2B1. py: (1) Given a queue with elements A,B,C,D,E,F: REAR/Left[F,E,D,C,B,A]FRONT/Right Describe inwordsONLY, the process of enqueue a new element ' G ' (i.e, inValue=G) into the queue. (No more than 120 words) (2) In terms of computer resources, comment on the performance difference between the enqueue operation developed by you and that based on the linked-list approach. (No more than 100 words)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
