In a stack data structure, the following items are inserted in the following order: Bob, Alice, Charlie, Eve, Zebra. Then three items are removed from the stack. Then two further items are inserted: Yelp, Pinion. Then two more items are removed from the stack. The next item removed will be __.

Respuesta :

Answer:

Alice

Explanation:

Stack is a LIFO(Last In First Out) type data structure.So the element inserted last will the first one to be removed from the stack.On insertion of Bob,Alice,Charlie,Eve,Zebra.The element at the top of the stack will be Zebra and bob will be at the bottom.So on removing three items from the stack Zebra,Eve,Charlie will be removed from the stack.On inserting Yelp and Pinion,pinion will be the top of the stack.On removing two more elements from the stack Yelp and Pinion will be removed and the top of the stack will be Alice.So the next item removed will be Alice.

ACCESS MORE