Which of the following real world scenarios would you associate with a stack data structure?

Which of the following real world scenarios would you associate with a stack data structure?
A. piling up of chairs one above the other
B. people standing in a line to be serviced at a counter
C. offer services based on the priority of the customer
D. tatkal Ticket Booking in IRCTC
 
Answer: A
Explanation: Stack follows Last In First Out (LIFO) policy. Piling up of chairs one above the other is based on LIFO, people standing in a line is a queue and if the service is based on priority, then it can be associated with a priority queue. Tatkal Ticket Booking Follows First in First Out Policy. People who click the book now first will enter the booking page first.
 

Tìm kiếm

Back
Top