Category Archives: Stack

Stack Class in Java

Java provides an inbuilt object type called Stack. It is a collection that is based on the last in first out (LIFO) principle. On Creation, a stack is empty. It extends Vector class with five methods that allow a vector to be treated as a stack. The five methods are: 1. Object push(Object element) :… Read More »



See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.

Stack | Set 3 (Reverse a string using stack)

Given a string, reverse it using stack. For example “GeeksQuiz” should be converted to “ziuQskeeG”. Following is simple algorithm to reverse a string using stack. 1) Create an empty stack. 2) One by one push all characters of string to stack. 3) One by one pop all characters from stack and put them back to… Read More »



See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.