Ask Question

Whatis the restriction placed on the push operation for an array-based implementation of a stack?

+3
Answers (1)
  1. 30 January, 15:08
    0
    if the number of elements in the array are equal to the size of the array then return - 1.

    Explanation:

    We are implementing stack using array. Stack is a LIFO (Last In First Out) type data structure. Insertion and deletion is from one end only.

    So while push operation or inserting elements in the stack using array we have to check that the capacity of array is not reached. If reached then no element can be inserted in the stack. If not then we can insert element in the stack.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Whatis the restriction placed on the push operation for an array-based implementation of a stack? ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers