Easy Data Structures Stacks & Queues
What is a stack and what are its main operations?
Answer
A stack is a linear data structure following Last-In-First-Out (LIFO) principle where elements are added and removed from the same end called the top. Main operations are push (add element to top), pop (remove top element), peek/top (view top element without removing), and isEmpty (check if stack is empty). All these operations have O(1) time complexity.
IIT Certified
Master These Concepts with IIT Certification
175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.
Relevant for Roles
Software Engineer Backend Developer Application Developer