#26 - Implement stack using Linked List in java - DataStructure Series Part 2

Поділитися
Вставка
  • Опубліковано 9 січ 2025

КОМЕНТАРІ • 25

  • @adityadeshmukh8927
    @adityadeshmukh8927 4 роки тому +1

    Very helpful Naveen. Thanks

  • @RakeshKumar-km4ri
    @RakeshKumar-km4ri 4 роки тому +1

    all the video are good , very easy to understand , Thanku Naveen

  • @AutomationTestingStudio
    @AutomationTestingStudio 4 роки тому +4

    initially head,extraHead = null;
    for first node, extrahead will be null and head points to the baseAddress of first node.
    Eg: head=1001; and extraHead=null.
    now we will insert value=10 in first node and first node's linkaddress will be extraNode's address (i.e,null)
    For second node insertion, extraHead will be 1001 and head will be 1002(second node's baseAddress) assume.
    insert value 20 at 1002 node.
    Now which will be the head.next value ?? will it be the linkAddress of 1002 or 1001 ? Confused here..Please explain

    • @jayaprakashreddy5801
      @jayaprakashreddy5801 4 роки тому +1

      head.next will point to 1st node(ie. 10). If you add 3rd node as value 30 & address as 1003, then 3rd head.next value will point to 2nd. Order of values will be stored as 30 & its pointer will point to 20, then it stores 20 & its pointer will point to 10, Then it stores 10 & the pointer of it will point to null.

    • @avikdhar
      @avikdhar 3 роки тому

      @@jayaprakashreddy5801 Exactly, but when Naveen explained in the diagram, its exactly the opposite to this. He said that 1st node's next pointer will point to second node and so on. Got confused because of that.

    • @jayaprakashreddy5801
      @jayaprakashreddy5801 3 роки тому

      @@avikdhar I can understand that at 14:50 you got confused. Actually, The head that point of time is 20 and head.next will point to 10 and the address of 10 will still be pointing to null. I think there should be have slight correction in the explanation. I hope it cleared your confusion.

    • @avikdhar
      @avikdhar 3 роки тому

      @@jayaprakashreddy5801 yes..thank you

  • @VineetKumar-eb3lv
    @VineetKumar-eb3lv 4 роки тому +2

    Thank you Naveen.

  • @aashisinghal1
    @aashisinghal1 4 роки тому +2

    Thank you Naveen for explaining this in easiest way. While implementing it I found if we call pop method when stack is empty it is giving NullPointerException as its not exiting the method. it can be remove by simply return -1 in if condition. Correct me if I am wrong.

  • @punitmishra2758
    @punitmishra2758 4 роки тому +1

    I have a doubt. Do we have to initialise the value of Head in LinkedListStack constructor ? Since head is an instance variable whose by default value is null.

  • @bhargavk5451
    @bhargavk5451 3 роки тому +1

    Thank you Naveen for your clear explanation. But, the animation/diagram that you used in the video is confusing with the code. Because, in stack of 3 elements, 3rd would point to 2nd and 2nd would point to 1st. if we add one more element, then that would point to prev head(3rd element here). But your diagram shows 1st pointing to 2nd and 2nd pointing to 3rd and so on. This becomes more confusing with the code in pop method when explained with your diagram. When pop is run, the head is removed and you are mentioning as head=head.next and explanation is in opp way. Please correct me if i am wrong. Thank you once again for your videos and wonderful playlists.

    • @avikdhar
      @avikdhar 3 роки тому

      Ya...I also have the same question...as par the diagram, the 1st node should have the next node reference but the code is exactly opposite.

  • @sureshkct
    @sureshkct 4 роки тому +1

    Intelli IDEA Id are you using ultimate or community Version?

  • @Baigan42
    @Baigan42 3 роки тому

    Hi Naveen, you could have mentioned why you entered capacity,top via constructor only.

  • @adityasrivastava5795
    @adityasrivastava5795 3 роки тому

    Thanks Naveen

  • @anand4546
    @anand4546 3 роки тому

    Sir, I request you to please make videos on internal architecture of hashing.

  • @shabanakhanpathan8664
    @shabanakhanpathan8664 4 роки тому +1

    For selenium testers is there any chance of asking the complex sorting algorithms like merge and quick sort.

  • @wickedsunny5913
    @wickedsunny5913 3 роки тому +2

    Mera to fuse ud gaya 😂😂 fir se dekhna padega

  • @shobhit9826
    @shobhit9826 4 роки тому +2

    2nd comment yeah