Using an imperative Definition, specify the abstract datatype for a software stack
Abstract data type for a stack is defined as an ordered collection of items where items are added to and removed from the end called the top in the ordered LIFO that is last in first out. The stack operations are as followed:
(i). Stack() creates a new empty stack
(ii). isEmpty tests whether the stack is empty
(iii). Size() returns number of items in the stack.
(iv). peek () returns the top item in the stack.
(v) pop() removes the top element in the stack
Comments
Leave a comment