I was trying to think of some non-CS related applications of the stack concept in the real life, unlike function calling, parsing, DFS, etc. but couldn't come up with any. For queues, I can think of several, e.g. assembly line in a factory, customer servicing in banks etc. but am not able to think of similar ones that work only via pushes & pops in the non-CS part of our daily life. Can someone please suggest somethings?
Your job.
When reducing staff, many companies are bound by agreements and regulations to use the "Last In First Out" to decide who goes and who stays.
The accountants like this because shorter service equates to lower redundancy payments. The unions or other staff representatives like this because it removes any possibility of favoritism and prejudice or victimization from the choices.
There is one real-life example that even uses the FIFO and LIFO terminology: accounting.
Whenever a company buys supplies, it counts those supplies as expenses not when it buys them, but when it uses them. For instance, a company may buy a thousand pencils today, but use them over a year, and for financial reporting purposes it can report that over a year.
But what if the company buys pencils today and a month from today, and the price has changed in the meantime? For financial reporting purposes, the company has to pick a price for the pencils as it uses them. A year from now, as it uses the last of the thousand pencils, it could use the price for today's pencils, or it could use the price for next month's pencils.
Accounting standards don't give the company leeway to make up prices, so the costs have to come from real supplies (and you can't use one month's price to expense both shipments of supplies), but in the US at least there is some leeway for the ordering of the supplies for accounting purposes. Under FIFO, the pencils are assumed to be on a queue: the oldest pencil is expensed first. Under LIFO, the pencils are assumed to be on a stack: the newest pencil is expensed first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With