What is a stack in data structures?

  • A data structure that allows random access to its elements.
  • A linear data structure that follows the Last In, First Out (LIFO) principle.
  • A sorting algorithm used to organize elements in ascending or descending order.
  • An algorithm used for traversing graphs.
A stack is a linear data structure that follows the Last In, First Out (LIFO) principle, meaning the last element added is the first one to be removed. It operates like a collection of elements with two main operations: push (to add an element) and pop (to remove the last added element).
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *