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
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.
@@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.
@@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.
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.
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.
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.
Very helpful Naveen. Thanks
all the video are good , very easy to understand , Thanku Naveen
Thanks for watching
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
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.
@@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.
@@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.
@@jayaprakashreddy5801 yes..thank you
Thank you Naveen.
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.
I am facing the same issue
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.
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.
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.
Intelli IDEA Id are you using ultimate or community Version?
Community version
Hi Naveen, you could have mentioned why you entered capacity,top via constructor only.
Thanks Naveen
Sir, I request you to please make videos on internal architecture of hashing.
For selenium testers is there any chance of asking the complex sorting algorithms like merge and quick sort.
Yes product company do ask
Yes in good product companies, startups.
Mera to fuse ud gaya 😂😂 fir se dekhna padega
😂😂😂
2nd comment yeah