English

Write an algorithm to implement push operation.

Advertisements
Advertisements

Question

Write an algorithm to implement push operation.

Very Short Answer
Advertisements

Solution

  1. Start.
  2. Initialize top with -1.
  3. Input the new element.
  4. Increment top by 1.
  5. Store the element at stack[top].
  6. Print Item Inserted.
  7. Stop.
shaalaa.com
  Is there an error in this question or solution?
Chapter 6: Stacks & Queues in list - EXERCISE [Page 123]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 6 Stacks & Queues in list
EXERCISE | Q 20. | Page 123
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×