Computer Science, asked by ayushi6740, 2 months ago

What is stack in computer science​

Answers

Answered by indraja69
1

Explanation:

In computer science, a stack is an abstract data type that serves as a collection of elements, with two main principal operations: Push, which adds an element to the collection, and. Pop, which removes the most recently added element that was not yet removed

Answered by MrTSR
1

Stack

Stack is an ordered list of similar data items.

Top of Stack: insertion and deletion are permitted to be  done only at one end called top of the stack.

Features of Stack

  • Stack is an ordered list of similar data type.
  • Stack is a LIFO structure. (Last in First out). Here, the element which is placed last, is  accessed first.
  • push() function is used to insert new elements into the Stack and pop() is used to  delete an element from the stack. Both insertion and deletion are allowed at only one  end of Stack called Top.
  • Stack is said to be in Overflow state when it is completely full and is said to be in  Underflow state if it is completely empty.

Stack Operations and their Functions

  1. Create-Stack() - Used for allocating memory.
  2. Isempty(S) – Used for checking if stack is empty or not; it returns a Boolean.
  3. Isfull() – Used for checking if stack is full; this also return Boolean.
  4. Push(S,e) – Use to add an element on top of stack.
  5. Pop(s) – Used to remove an element from the top of the stack.
  6. 6. Top(S) – Used to display an element in the stack.

Similar questions