Nikhil Lohia is the GOAT. I once saw him save a entire family from a burning car after saving a drowning puppy. He also helped me get through my Grad CS class. Thank you Nikhil, you are everyone's hero.
Hey Nikhil, I have seen some of your videos. Your videos are really great. Your way of speaking, your pace and style of explaining any problem is marvelous. Thanks for the detailed explanation. 🖖🤩 However just a note for this deletion video here and the other insertion one, while deleting/adding the node from/to the link, you considered the index from 1 while explaining, but from coding perspective, it starts from 0. 🙂
thanks for your feedback and motivation. I understand the confusion it might have caused. Sometimes, it is easier to explain in a certain way and writing code in the other. I will try to clear things up more in my upcoming videos.
@@nikoo28 thanks, nikhil, bro, I want more favor from you side coz its magnetic what you teach, that, similar to SLL and DLL, please make complete videos on Arrays 1D and 2D, strings, recursion , two pointers, hashing, bit manipulation, etc, concept, syntax and dry run. And , club all questions in a separate video, so that, all concept learn in one and practice them in another. It will synchronize our concept building. Array and string videos you uploaded, are just one. I hope u got the point. Coz , I want to DSA once and forever and no other good source m looking now other than you which fill the gap. So brother just come up with that. Thanks.
public ListNode deleteAtMiddle(ListNode head, int position) { ListNode ptr = head; // If position is 1, call deleteAtBeginning and return its result if (position == 1) { return deleteAtBeginning(head); } // Move to the node before the one to be deleted for (int i = 0; i < position - 2; i++) { ptr = ptr.next; } // Get the node to delete ListNode nodeToDelete = ptr.next; ListNode nextNode = nodeToDelete.next; // Point the next of ptr to nextNode ptr.next = nextNode; return head; }
honestly speaking ur the best guy in RUclips till today who thought the linked list so easily and with minimum time
Nikhil Lohia is the GOAT. I once saw him save a entire family from a burning car after saving a drowning puppy. He also helped me get through my Grad CS class. Thank you Nikhil, you are everyone's hero.
Hey Nikhil,
I have seen some of your videos. Your videos are really great. Your way of speaking, your pace and style of explaining any problem is marvelous.
Thanks for the detailed explanation. 🖖🤩
However just a note for this deletion video here and the other insertion one, while deleting/adding the node from/to the link, you considered the index from 1 while explaining, but from coding perspective, it starts from 0. 🙂
thanks for your feedback and motivation. I understand the confusion it might have caused. Sometimes, it is easier to explain in a certain way and writing code in the other. I will try to clear things up more in my upcoming videos.
thanks, Nikhil, you have made, SLL so simple, now i can visualize things related to SLL. thanks, bro
Thank you so much. Always remember, visualisation of any problem helps to understand better 😄
@@nikoo28 thanks, nikhil, bro, I want more favor from you side coz its magnetic what you teach, that, similar to SLL and DLL, please make complete videos on Arrays 1D and 2D, strings, recursion , two pointers, hashing, bit manipulation, etc, concept, syntax and dry run. And , club all questions in a separate video, so that, all concept learn in one and practice them in another. It will synchronize our concept building. Array and string videos you uploaded, are just one. I hope u got the point. Coz , I want to DSA once and forever and no other good source m looking now other than you which fill the gap. So brother just come up with that. Thanks.
Tq for your effort to make it easy
sir at 10:14 the loop should run till i < pos - 2 and not till pos - 1 . Please can you check it once ?
nicely explained thanks
how to pass parameters from main method to delete the values it's not present in your code
that would mean deleting a value, thanks...I will cover that portion in another video soon.
very nice.. Thank you
Why do we return head from the method ?
That is because we can only refer a single linked list from the head pointer.
If we return any other node, the head will be lost.
Thanks Man
thanks !
Great
circular linked list please teach
I will add a video on circular linked list
public ListNode deleteAtMiddle(ListNode head, int position) {
ListNode ptr = head;
// If position is 1, call deleteAtBeginning and return its result
if (position == 1) {
return deleteAtBeginning(head);
}
// Move to the node before the one to be deleted
for (int i = 0; i < position - 2; i++) {
ptr = ptr.next;
}
// Get the node to delete
ListNode nodeToDelete = ptr.next;
ListNode nextNode = nodeToDelete.next;
// Point the next of ptr to nextNode
ptr.next = nextNode;
return head;
}