Algorithm and data structure examples in Java.
A stack is basically a data structure which uses the following: Methods for inserting the data by the help of push operationMethods for removal of data by the help of pop operation.
Peak method is supported by Stack implementations. It will make the head to be read without removal from Stack. Last in First out policy is used in Stack. This means that data which has been inserted in data structure at last will be made to get removed first.