Showing posts with label Stack. Show all posts
Showing posts with label Stack. Show all posts

Do you know, How to reverse a number using stack?

Given a number, write a program to reverse this number using stack operations like push(), and pop() in Java. For example Input: 123456 Output: 654321 Input: 900 Output: 9 Lets see simple java program...

Stack implementation using Linked List

We have seen Stack implementation using array in our earlier tutorials. Now lets see same stack implementation using Linked List and how to push() and pop() values in Stack. Below is the simple example...

Implement Stack in Java

In our earlier tutorial we have seen how to use default Stack class in Java and their methods like push, pop, peek etc., Suppose in any of the interview if interviewer asked us to...

Stack class in java

Basically Stack represents last-in-first-out (LIFO) ordering of objects. In Java Stack extends Vector and defines its own five methods along with default methods which allow a vector to be treated as a stack and those...

Heap and Stack in Java

We are discussing few interview questions from our earlier tutorials and its a follow-up with same interview questions in Java. Questions are  How memory managed in java?  What is Heap and Stack memory?  What...