How to implement a Stack using a Linked List in Java ? | Stack Data Structure

preview_player
Показать описание

Watch all my playlist here:

Want to land a software engineering job in the IT industry? This course - 'Visualizing Data Structures and Algorithms' is here to help. The course walks you through multiple Java algorithms, data structures problems, and their solutions with step by step visualizations, so that you are actually learning instead of blindly memorizing solutions.

The course covers in and outs of Data Structures and Algorithms in Java. Java is used as the programming language in the course. Students familiar with Javascript, Python, C#, C++, C, etc will also get to learn concepts without any difficulty. The implementation of various Algorithms and Data Structures have been demonstrated and implemented through animated slides. It covers many interview room questions on Algorithms and Data Structures. The questions and solutions are demonstrated by -

1. Animated slide. (To make visualization of algorithms faster)
2. Coding algorithm on IDE.

The course covers topics such as -
0. Algorithm Analysis
1. Arrays
2. Matrix
3. Singly Linked List
4. Doubly Linked List
5. Circular Singly Linked List
6. Stacks
7. Queues
8. Binary Tree
9. Binary Search Tree
10. Graphs
11. Priority Queues and Heaps
12. Recursion
13. Searching
14. Sorting
15. Strings
16. Trie Data Structure
17. Dynamic Programming
and many more ...

#dsa #algorithms #coding
Рекомендации по теме
Комментарии
Автор

I spent almost 2 hours looking for LL based implementation of stack. Yours was the only one that has explained in very simple manner. Too impressive way of teaching! Love from California !!

amitpanc
Автор

Best series for DS & Algo. I am also 10 yrs java exp guy. Was looking for DS & Algo free course over YouTube with java implementation and found this. Hats Off To You Man....Excellent Work. GOD BLESS YOU :)

shubhamagarwal
Автор

Wonderfully explained and very easy to understand.
Anybody who is interested to see the full stack elements after push and pop operations use the below code and call printStack() method from the main method after push and pop operations:
public void printStack() {
if(isEmpty()) {
throw new EmptyStackException();
}

ListNode temp = top;
while(temp != null) {
System.out.print(temp.data + "->");
temp = temp.next;
}
System.out.println(temp);
}

NeverGiveUpTryin
Автор

Dinesh!!! Excellent tutorial. Real hard work man. Appreciate your efforts. Helped me a lot to understand Data Structure and Algorithms with real time examples.

mustafakamalsirajudeen
Автор

Thanks a lot Dinesh for awesome explanation.

ashwiniv
Автор

Very clear explanation of data structure implementation that i ever saw
Thank you so much sir ❤️
One request please upload video on how to start competitive programming.

AniketKumar-lvtd
Автор

Thank you very much, I understood a concept.

levsblinnikovs
Автор

While using pop it is better to create a temp pointer referring to tops next node and make tops next node to null and then move top to temp. So Java garbage collector will be able to collect the removed object.

charan_
Автор

Very helpful series sir.🤗 Sir please make a playlist on collections framework.🙏

vinodgupta
Автор

sir stack element display kese karayenge

neerajrawat
Автор

about 1:50 you say top is pointing to null but i think you mean top = null

ImranKhan-iusg
Автор

What is the use of the constructor stack, by default top is null and length is 0 right

samuel_william
Автор

what is the time complexity of this program?

shantanum
Автор

Sir I've a question why private ListNode are you using? Can't we use public

mrinmoykalita
Автор

In pop operation won't we have to decrement top?

arijitmohapatra
Автор

what if i write::
private static Listnode top

abhaypratapsingh_life
Автор

What difference linkeList araay nd stack

sanjushekhawat
Автор

Is this the stack implementation using linked list sir?

updates
Автор

can we print stack just like we did in linked list:- while(top!=null)and

vasudevparmar
Автор

Wow, learning linked lists was so difficult compared to this.

joecamroberon