What are the different between a stack and a queue?

By vivek kumar in 20 Jul 2024 | 08:13 pm
vivek kumar

vivek kumar

Student
Posts: 552
Member since: 20 Jul 2024

What are the different between a stack and a queue?

20 Jul 2024 | 08:13 pm
0 Likes
Prince

Prince

Student
Posts: 557
Member since: 20 Jul 2024

What are the different between a stack and a queue?


  • Stack Example:
    • Consider a stack of plates. You can only add or remove the top plate. The last plate placed on the stack will be the first one you remove.

  • Queue Example:
    • Consider a line at a checkout counter. The first person to get in line is the first one to be served. New people join the end of the line, and the person at the front is served next.

Both stacks and queues are essential in computer science, each serving different needs and applications based on their operational principles.


21 Jul 2024 | 02:14 am
0 Likes

Report

Please describe about the report short and clearly.