2) Given that the Stack and Queue classes have been implemented
correctly, what is the output of the following?
s = Stack()
q = Queue()
s.push(3)
q.enqueue(4)
q.enqueue(6)
q.enqueue(s.pop()+2)
s.push(q.dequeue()+5)
q.enqueue(s.pop()-1)
print(q.dequeue(),q.dequeue(),q.dequeue())
2) Given that the Stack and Queue classes have been implemented correctly, what is the output of the following? s = Stac
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
2) Given that the Stack and Queue classes have been implemented correctly, what is the output of the following? s = Stac
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!