Stack Implementation in Java using Linked ListsTech by Sunny Srinidhi - December 31, 2019January 3, 20201 More in The Data Structures series. In our previous Stack implementation post, we saw how we can implement a Stack data structure using an ArrayList. But as you can imagine, that's not the right way to implement a stack. A much better implementation is using a LinkedList. In this post, we'll see just that. If you've missed it, I've already written about how to implement Single Linked List (SLL) and Double Linked List (DLL), and I'd encourage you to check those two out first as we'll be using the same Linked List implementation here, and you can find more detailed Linked List explanation there. Assuming that you have done that, let's now move on to the Stack. The Node The first thing we have
Stack Implementation example in JavaTech by Sunny Srinidhi - December 20, 2019December 23, 20192 More in The Data Structures series. A stack is one of the most simplest data structure to understand. If you had data structures in your academia, you already know what it means. It’s a simple Last In First Out (LIFO) queue. What that means is the last element to enter the stack will be first element to go out of the stack. Let’s try to understand the concept first with a few illustrations. The concept Suppose we have an empty container which looks like the container shown in the image below: Empty stack That’s pretty simple to understand. Now suppose again that we “push” a string with value “string1” to this empty stack. The stack now looks like this: Stack with one element That’s pretty simple to