Java Programming – Data Structure and Algorithms in Java

///Java Programming – Data Structure and Algorithms in Java

Java Programming – Data Structure and Algorithms in Java

FavoriteLoadingAdd to favorites

Data Structure tutorial and Algorithms in Java with practical examples and code practices. This java data structure tutorial will cover up bunch of topics and some of them are the following:


Stack in java
Queue in java
Sorting in java
Linked list in java
Singly Linked list in java
Doubly linked list in java
Trees in java
Binary search tree in java
Hash table in java
Student Management System

Javascript Tutorial:

Facebook group:


Follow Awais On Twitter

Follow me on Twitter:

OOP in Java:

Other java tutorials:

By |2017-05-08T19:51:23+00:00May 8th, 2017|Java Video Tutorials|24 Comments


  1. Saboor Hamedi May 8, 2017 at 7:52 pm - Reply

    do you have a project with JFrame that drag and drop it not swing

  2. ziddy26 May 8, 2017 at 7:54 pm - Reply

    +Awais Mirza, Thank you for the lecture. I wonder why you initialize top = -1 when you created IntStack. Could we not have gave it a value of 0? Would it have made any difference?

  3. shubham singh May 8, 2017 at 7:55 pm - Reply

    very useful thanks a lot

  4. Dinesh Naik May 8, 2017 at 7:58 pm - Reply

    why we need to go for customised stack instead we can use stack() right?

  5. Arbi Themarajuwanabarbie May 8, 2017 at 8:10 pm - Reply

    Hi, thank you for the video tutorial. Extremely helpful!

    I have a question for the stack, in your main class you System.out.println(stack.pop()),why does the console print the value of Stack[top] (Stack[3]) which is "9"
    and not the value of
    Stack[top–] (Stack[2]) which is "6"?

    for example in your main you popped twice and got value 9 and 6, why didn’t the console return value 6 and 4 seeming as the functions returns Stack[top–] ?

    would love if you can clear this confusion for me.

  6. Calvin P May 8, 2017 at 8:15 pm - Reply

    The pop implementation of stack decrements the variable top– , but it never clears the reference of the element in the array.
    Shouldn’t you be setting stack[top–] = null ?

  7. Saboor Hamedi May 8, 2017 at 8:16 pm - Reply

    thank you, sir, for this link I would like to ask sir how to make
    installer the java project first the drag and drop the project and
    second, the swing I’m confused with them.

  8. muhammad rafiullah May 8, 2017 at 8:17 pm - Reply

    kindly up load your Tutorials regarding web application development in java.

  9. Viswa Chikkala May 8, 2017 at 8:23 pm - Reply

    hi, in deleting the node from linkedlist, why did you use (y==null || y.value==item); break;
    when the y.value has the required item, you can delete it right, why are you breaking.

  10. Kamesh Emani May 8, 2017 at 8:27 pm - Reply

    Thank you so much.. In any java interview data structures, searching & sorting algorithms play a major role..
    Thanks for compiling all into a single video 🙂

  11. Dnyanesh Sawant May 8, 2017 at 8:28 pm - Reply

    Hey! You have made a very nice and useful tutorial. The content has helped me a lot and has also enhanced my algorithmic problem solving skills. Just one suggestion that instead of making a video of complete 3 hours, make shorter videos and create a playlist. I’ll be easier for us to learn.

  12. richa May 8, 2017 at 8:32 pm - Reply

    Thanks. Its very nice video.I have one doubt ,i was trying to implement delete in linked list as per your code but it was working fine with 2 data insert(2),insert(5) but after insert(5),insert(8),insert(9) delete of 5 was not possible while delete of 8 and 9 was fine.Please check.
    Also in queue for object enque i am getting null pointer exception.

  13. Kasi Veeranan May 8, 2017 at 8:33 pm - Reply

    home improvement

  14. sumanth varada May 8, 2017 at 8:35 pm - Reply

    @Awais Mirza Thank you so much for such a beautiful tutorial. I have been trying to learn data structures from a long time and read few tutorials online & gain some basic understanding. But None of them given me a confidence that I can learn the data structures. Please suggest me some resources to continue this, Thank you ..!!

  15. Tunwa Malumi May 8, 2017 at 8:35 pm - Reply

    do we ever enter the while loop in this code while inserting items into this linkedlist? because everytime node y = head is set, it means that the = 0……. im relatively new to java so im not sure if im having a brain block at the moment

    public class MyIntLinkedList {

    Node head;

    public MyIntLinkedList() {
    head = new Node();
    head.value = 0; = null;

    public void insertItem(int item) {
    Node x = new Node();

    Node y= head;
    while ( != null) {
    y =;
    x.value = item; = null; = x;

    class Node {
    int value;
    Node link;

  16. santhosh nadiminti May 8, 2017 at 8:36 pm - Reply

    I really appreciate your efforts for uploading this video. Thank you so much !!

  17. Saboor Hamedi May 8, 2017 at 8:39 pm - Reply

    thank you, sir, i subscribed your channel this is the really nice tutorial

  18. Zach Stecher May 8, 2017 at 8:39 pm - Reply

    Quick comment: For the queue ShowAll function, wouldn’t it be simpler to write a isEmpty function(the same way you did for stack) and do

    while (!q.isEmpty()) { System.out.println(q.dequeue)); }

    This seems cleaner to me but if there’s some reason for not doing it that I’m not seeing I’m a sponge for information. Thanks!

  19. Viswa Chikkala May 8, 2017 at 8:42 pm - Reply

    Also I wanted to know, How to delete lst node.Because it is not connected to ay other node address

  20. Jony Jackson May 8, 2017 at 8:43 pm - Reply

    In PersonStack Class, We don’t need to call toString() method. Because java compiler internally invokes the toString() method. So we can put simply stack.pop(). Please correct me If I am wrong…

  21. Om Prakash Jha May 8, 2017 at 8:44 pm - Reply

    It’s a nice one. I have only one remark that why not call toHashcode() method within the insert() method of Hastable class and pass roll number as a key to insert method. I don’t see a reason to expose toHashCode method outside Hashtable class and it can be made private.

    There is some additional null check as well in fetchStdData() which can be minimised as well.


  22. Awais Mirza May 8, 2017 at 8:44 pm - Reply
  23. muhammad rafiullah May 8, 2017 at 8:47 pm - Reply

    Thank you Awais

  24. rte May 8, 2017 at 8:47 pm - Reply

    in QUEUE, around 30 min. in enque and deque function variable are used opposite of what was told in ms paint and other during the coding…it would confuse people…

Leave A Comment