Professional Documents
Culture Documents
Instructors:
Data Structures and • Marius Joldoş (lectures + lab. sessions),
• Room D3, 71-73 DorobanŃilor St.
Algorithms • Tel. 0264-401276
• Marius.Joldos@cs.utcluj.ro,
• Paulina Mitrea (lab. sessions)
• Paulina.Mitrea@cs.utcluj.ro
out (LIFO) principle. • pop(): Removes the top StackElement of stack and returns it; if
stack is empty an error occurs
• StackElements can be inserted at any time, but • Input: none; Output: StackElement
only the last (the most-recently inserted) The following support operations should also be defined:
StackElement can be removed. • size(): Returns the number of StackElements in stack
• Input: none; Output: integer
• Inserting an item is known as “pushing” onto the • isEmpty(): Return a boolean indicating if stack is empty.
stack. “Popping” off the stack is synonymous with • Input: none; Output: boolean
removing an item. • top(): return the top StackElement of the stack, without removing
it; if the stack is empty an error occurs.
• Input: none; Output: StackElement