0:00 Intro 0:34 Deletion of the head of LL 6:18 Deletion of the tail of LL 15:47 Deletion of the Kth element of LL 30:14 Delete the element with value X 32:15 Insertion at the head of LL 35:15 Insertion at the tail of LL 38:41 Insertion at the Kth position 51:22 Insertion before the value X Thank You Striver for the Playlist and your hard work
@GotetiKrishnasrikar3 ай бұрын
@immortal6978 Жыл бұрын
A hell lot of hardweork for the community. Hat's off your dedication to coding. Hit like on video if Agreed.
@AnshGupta-pr7qoАй бұрын
How could someone be so perfect at explaining.....literally hats off to you striver If in life i ever had a chance to meet or see you it'll be one of mt best day
@loremvampire6343 Жыл бұрын
I was waiting for this playlist since one month. Thank you so much Sir
@chrish44032 ай бұрын
So grateful , Linked list is a topic ive been avoiding to learn from my boards due to lack of understanding, but in just two videos you have made me so well versed with linked list, wish i found this video two years ago,
@vedikamishra009Күн бұрын
same, but 2 years ago it didn't exist sadly :(
@publicuses8589 Жыл бұрын
Striver bhaiya u r a gemmmmm lot's of respect for u 🫡🫡
@ronakvaghela27143 ай бұрын
One of the best coding content on the whole youtube. You're an inspiration to everyone and a great example of how hardwork looks like. Thanyou so much for doing this. you deserve everything you wish for and hope to see such content more from you.
@5640_GlenaSAHA4 ай бұрын
you are the best one to teach linked list in the easiest manner, I wasted my whole third semester understanding linked list but still failed. But you are really amazing!!!!
@ShubhraneelChakraborty-cj8zm4 ай бұрын
For insertion of a node at the head of the linked list, we can also do this: Node temp=head; head=val; head.next=temp; return head; What its doing is that, the previous head is being assigned to a temporary pointer, and the new node being inserted (val) is being assigned to the initial head pointer (head), a simple swap. Then the head's next is being assigned the temporary pointer (holding the initial head) to link the new head and the previous one. Hope that helps. And thank you Raj bhaiya for such an amazing video again, the explanation was so clear.
@GirishaMalani-fs4ch4 ай бұрын
but then what will be temp->next?
@ShubhraneelChakraborty-cj8zm3 ай бұрын
@@GirishaMalani-fs4ch Forgot to mention, it is in Java, so it will be collected by the garbage collector. For C++, you need to free that pointer.
@VishalGupta-xw2rp Жыл бұрын
Notes 33:33 Insert at head 50:01 Delete Nicely done
@Ranganadhamkrishnachaitanya278 ай бұрын
How code will work I'm confused
@anuragprasad61169 ай бұрын
For deletion at k index, you can check if(cnt == k-1) and perform curr->next = curr->next->next; instead of keeping a previous pointer.
@purvamjain49533 ай бұрын
it wil give u error, assume u have 4 elements and they asked to remove 5th element. with cnt=k-1 it will try to access next element of null which will throw error unless u catch it manually
@sanjayutchula78492 ай бұрын
In order to avoid this we can maintain a int size variable in class and declare it public update every time we add or delete node and for deleting a kth node we can check at starting if it exceeds the boundaries and throw an error else we can run a for loop for k times and move the temp pointer to reach before which we want to delete @@purvamjain4953
@VivekKumar-kx2zf2 ай бұрын
@@purvamjain4953 no that can also be skipped using a if condition.. Look at this code : static Node DeleteAny(Node head, int k) { Node temp = head; if(k == 1) { head = head.next; return head; } for(int i = 1; temp != null;i++) { if(i == k-1 && temp.next!=null) { temp.next = temp.next.next; } temp = temp.next; } return head; }
@mdfaizanmdfaizan6041Ай бұрын
@@purvamjain4953we can apply for a condition before
@santhoshl-zq1op22 күн бұрын
But , at the starting itself , we check the condition if( k > lengthof LL ) return head;
@AmanSharma-xy1qm11 ай бұрын
All the video lectures and the articles helped me a lot to gain confidence in DSA and will be helping me in the interviews. Thank you Striver bhaiya for bringing such amazing content for free.
@hareshnayak73027 ай бұрын
Understood,Thanks striver for this amazing video.
@prathameshjadhav2942 Жыл бұрын
Next level teaching ❤
@utkarshsingh092 ай бұрын
His teaching skills!!! Hats off!
@5640_GlenaSAHA4 ай бұрын
believe me on this when i say he is the best!!
@vaishnavi.pvaishnavi.p84749 ай бұрын
superb explanation sir...... i want to listen you more and more
@dipingrover19703 ай бұрын
Such a hard topic explained in best way possible Thanks a lot man 😊.
@S3aw0lf9 ай бұрын
Superb explanation, was able to do the code by myself starting from 2nd video after understanding you explanations.
@prajjwalsinghrathore9458 Жыл бұрын
Thanks bhayya for the playlist, we appreciate it , it would be good if you add time-stamp to it.
@Rohit-ht8kdАй бұрын
at 29th min the code for if(k == 1) is head = head.next; return head: but you have written Node temp = head: return head;
@prathamrajsrivastava980711 ай бұрын
hey striver... when's the strings playlist coming out??
@uchihaitachi53765 күн бұрын
Striver love you bro how can you make things very simple thank s bro❤
@pranaycc Жыл бұрын
Crisp And Detailed, 💕💕
@chetna2532 ай бұрын
a lot of hardwork ...respect bruh
@GauravGupta-no7sf9 ай бұрын
00:04 Deletion and insertion in linked lists 02:21 Freeing memory in C++ and Java 06:58 To delete the last element in a linked list, the list must have at least two elements. 09:34 Deleting the tail element from a linked list 14:28 Demonstration of removing elements from a linked list in Java. 16:46 Deleting elements from a linked list 21:04 Discussing traversal and conditions for stopping 23:27 Managing deletion and insertion in a linked list 28:03 Removing elements from a linked list in Java 30:23 Deleting elements from a linked list based on given value. 34:35 Inserting before and after the head in linked list 36:44 Inserting a new node at the end of the linked list 41:06 Insertion in linked list at different positions 43:21 Traversing and manipulating temporary in linked list 48:12 Covering all the H cases for node insertion in a linked list 50:27 Inserting and deletion in linked list 54:42 Insertion before a value in a linked list
@glife549 ай бұрын
Ai
@lordgaming717820 күн бұрын
Thank you for the explanation
@AtanuDebnath4 ай бұрын
Raj Dada , Love you! ❤❤❤ You make the hard things look so easy!
@sauravkumar990011 ай бұрын
Bhaiya please make a playlist videos on Strings from basic to advance
@Ady-tf1jm3 ай бұрын
Best Playlist for beginners.
@harshitgarg2820 Жыл бұрын
Completed this video and done all the 11 questions of the sheet.✅✅
@himanshukaushik922310 ай бұрын
Bro last 2 questions ma compilation error bta Raha insertion ma sheet ka
@harshitgarg282010 ай бұрын
@@himanshukaushik9223 bhai typos me error hogi, ek baar dobara check kro fir run krna, agr vs code use krr rhe ho toh mingw ko reinstall krke dekho
@himanshukaushik922310 ай бұрын
Bhai coding ninja pa last 2 question compile error bta rahe hai
@newbie80514 ай бұрын
0:34 ha, my initial thought was to use a slow and fast pointer, and when fast pointer approaches the node to be deleted, we skip it by having next of slow pointer be the next node
@ompawar9791 Жыл бұрын
I searched for this kind of videoes from last few days. Now i got that man ->striver.........YOU CREATED ME AS A POINTER WHERE I STORED ADDRESS OF YOUR CHANNEL IN MY HEART❣❣❣❣❣❣❣❣
@ompawar979111 ай бұрын
wow
@DeepikaaSelvam3 ай бұрын
Waiting for Strings Playlist !.. No one is talking about the String Concept!!!
@MOHAMMEDMOJAHID-rg8sc3 ай бұрын
Me too
@JalalMujawar3 ай бұрын
Code for removing a node without knowing the head: public void deleteNode(ListNode node) { node.val = node.next.val; node.next = node.next.next; }
@AtulPal-i5s2 ай бұрын
Waiting for String Playlist
@HarishKumar-jm5bk Жыл бұрын
Striver can u please make series on binary numbers number theory and bit manipulation there is no video on youtube please make this video if possible
@dhikshitha769411 ай бұрын
Awesome video! In deletion of last/tail node in the base case if either the length is 0 or 1 we return null, but when length is 1 we should free the allocated memory that is delete head and then return nullptr right?
@MyAnish22 Жыл бұрын
@25:40 timestamp - we can also write prev->next = temp-> next? Also, if k==4 then tail gets deleted but what about indicating prev as the new Tail? Can understand, if any node pointing to nullptr is a tail then its fine.
@Shikaslad-s5f3 ай бұрын
don't know what might be the issue but if k = n+1 where n = length of LL it is still removing the last element from LL Here is the code Node* removek(Node* head, int k){ if(head == NULL)return head; if(k==1){ Node* temp = head; head = head->next; delete temp; return head; } int count = 0; Node* prev = NULL; Node* temp = head; while(temp != NULL){ count++; if(count == k){ prev->next = prev->next->next; delete temp; break; } prev = temp; temp = temp->next; } return head; }
@omkarsawant92676 ай бұрын
Guys during Insertion kindly modify your node constructor or else you will get argument error. Modified code below-> class Node { public: int data; Node *next; public: Node(int data1, Node* nextNode = nullptr) { data = data1; next = nextNode; // argument added } }; Below Insert Node code--> Node* insertHead(Node* head, int val){ Node* temp = new Node(val, head); return temp; } int main() { vector arr = {2, 5, 8, 7}; Node *head = convertArr2LL(arr); head = insertHead(head, 18); print(head); return 0; }
@ARNAVGUPTA-s1m2 ай бұрын
If we create a dummy node before head, we will not have to worry about edge cases. Just remember to return dummy->next.
@itsksujan6 ай бұрын
35:00 don't we have to update the head to point to the new node that is inserted at the head ?
@sonyshaw99646 ай бұрын
Indeed supreme quality article
@shivamswarnkar776322 күн бұрын
In the very last code which he has written we have to write while(temp.next.next not equal to null) instead of while temp.next not equal to null. If I am wrong, would be grateful for corrections.
@gyanendrasonkar31449 сағат бұрын
I feel the condition is fine and safe to have. eg: case1) 1->null key = 1, ele= 2 if (head.val == key) return new Node(ele, head) works. 2->1->null Case 2) 1->2->null key =2, ele=3. temp =head; So , temp points to head, temp @1. (temp,head) 1 ----> 2->null if temp->next->data is same key( 2==2) , yes create a node, x = new Node(ele, temp->next) x 3---> 2---> null ^ | 1(temp,head) temp -> next = x; x 3---> 2---> null ^ | 1(temp,head) 1->3->2->null Another example::: 1-2-3-5-6-null key =5, ele 4 when we found the key, ( temp->next-data== key), stop here and add the node ^^^ head temp 1-----2-----3--------5---------6---null x = new Node(ele, temp->next) h temp x 1----2-----3 4------5----6--null ( remember temp next still pointing to 5 , can't draw ^^) temp -> next = x; h 1-2-3-4-5-6-null I hope it is cleared now...
@SanthoshaK-px8rq5 ай бұрын
public Node DeleteK_ele(Node head, int k){ Node temp = head; if(k == 1){ temp = head.next; return temp; } int i=1; while(i
@AbhishekRanjan-wk7xp4 ай бұрын
but how will you handle the case when k>length of linked list
@AshokKumar-td2qo10 ай бұрын
Hey Striver you are my inspiration. Very thank you for LinkedList playlist ❤❤ Please suggest dbms in english video i can't understand hindi
@beaware70 Жыл бұрын
Great explaination sir❤❤❤❤
@vivekgautam97662 ай бұрын
Make a series on strings from basics to advance.
@vivekkumar8419 ай бұрын
awesomee lecture bhaiya!!!
@Student-j4u5 ай бұрын
to delete kth element when cnt==k can we write prev=temp.next instead of prev=prev.next.next
@AnujTiwari-g8o2 ай бұрын
you are a star bro...🔥🔥🔥🔥🔥🔥
@doremon810727 ай бұрын
loved it, Jai ho striver bhaiya
@Ravithasingh089 Жыл бұрын
Glad to be the First viewer brooooo🎉🎉🎉. Thank you so much for this quality content.!!
@bullymaguire23355 ай бұрын
is there a python playlist for linkedlist im unable to find it .
@Ayeshasingh7204 ай бұрын
so.... finally i m understanding LL🙂
@rohitkuttum31023 ай бұрын
in delete tail remeber to free the head if (head->next==null) while using c++ . ignore java,python,js developers.
@ThakurIsGeek10 ай бұрын
good work i have learn alot from you
@alokkulkarni78545 ай бұрын
when i tried to run the the code in vs code it showed error in many lines especially those where node was used as data type for function , can anyone clear why so ?
@saitejanedunoori54516 ай бұрын
great work and thank you THALA
@adebisisheriff1599 ай бұрын
Thanks so much Striver!!!!
@junaidmetkari63654 ай бұрын
waiting for string playlist🙂🙂
@khushisaraswat58264 ай бұрын
Nice tutorials u have removed the need of such paid dsa courses....
@jainkokila23352 ай бұрын
55:30 found is bool it cannot store 1 it can store true to solve our purpose
@HitanshuRathi-zz5vn8 күн бұрын
Understood Thanks brother
@SurajKumar-ku1lg7 ай бұрын
why we take for cnt =1 as increase by 1 and why not intialise prev as head as move on
@Dibyadipan2 ай бұрын
I have a small doubt in 3:48 where we are writing the code for removing the head of the linked list. the code snippet is as follows: private static Node removeHead(Node head) { if (head == null) { return head; } head = head.next; return head; } Here if we look at the first edge case where head==null is being tested. If i am not wrong that means the linked list is empty. so if the linked list is itself empty/having null value then it is obvious that removing the head will result in returning the null value right? And Striver said while explaining that if there is only one element too then the element behaves as both the head and the tail so removing the head will result in returning a null value...but here we are not checking that ie we are not checking if (head.next == null ) why is that so could anyone please explain me?
@SpeedBirbАй бұрын
because if head->next is null, we are setting head=head->next after the if statement, which will make head=NULL, and return null. So there is no need to check for head->next
@mma-dost9 ай бұрын
The question which was deleting the node whose pointer is given to you not the linked list head pointer that question is not covered right ? Its in the sheet last question Singly LL
@albela74347 ай бұрын
greatttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt lecture i ever watched
@ShubhamKumar-me7py6 ай бұрын
hey can we do dsa together
@agnivadutta9699 ай бұрын
In Java, removing head program, isn't the temp variable needs to be set null before garbage collection?
@TS-oj3vd8 күн бұрын
25:31 what if k=2? code will break giving error. prev is still null.
@shivanisahu807526 күн бұрын
in java how to print full ll with changes when we return head so they print vlue of head only plz tell me how to print new ll
Anyone submitted last 2 questions on coding ninja it show compilation error
@hardikpatel3526 ай бұрын
Thanks a lot striver, understood
@vilen268510 ай бұрын
Thankuhh sir for giving code in java !!!!
@simranmaity725210 ай бұрын
Can you please provide the code ..
@siyonabansal67035 ай бұрын
why dont we take k-1 instead of previous in kth element
@algorithm_based26 күн бұрын
in some case if the head is not given what we can do ?
@amanasrani64052 ай бұрын
Thank You so muchhhhh ❤❤❤❤❤🙏🏻, understood
@Vishu2-38 ай бұрын
27:54 prev -> next = temp -> next; free(temp); correct or not?
@BadalJena-oh6qu3 ай бұрын
inserting at kth positition 38:00
@ShivamKumar-oj7udАй бұрын
in deletion of value...it will not be able to delete multiple values of list
@satyamrath68186 ай бұрын
Can you please attach the test link as well for practice. Thanks
@jevinkardani8 ай бұрын
can someone explain what is the difference b/w NULL and nullptr ?
@bharanitharan.m11583 ай бұрын
Hey, When you want to delete 1st position of linkedlist in at any position you got wrong answer
@purvshah4260 Жыл бұрын
god level explaination
@36nchiranjeevi5311 ай бұрын
Great explanation
@DevashishJose8 ай бұрын
Thank you so much.Understood
@darshilmodi68515 ай бұрын
When is the string playlist releasing ?
@AniketKumar-hf2bo7 ай бұрын
thnx for amazing video ❤❤❤👌👌👍👍👍👍
@radha749210 ай бұрын
sir while deleting the Element using its value like given example mein jab hum 12,5,8,7 mein se 12 ko remove krenge using removesEl(head,12) toh error aa rha h (bhot sari random values dikha rha h), I need help, i checked my code more than 8 times but error nhi resolve ho rha, plss help someone
@anuragprasad61169 ай бұрын
code to post kr de behn
@TON-10810 ай бұрын
Understood, Thanks!
@ishita83055 ай бұрын
please upload the strings playlist sir..
@deepakbhatt55511 ай бұрын
nicely explained !
@anshukumari62269 ай бұрын
Thanks for the video!
@supernova4467 Жыл бұрын
idk no why i cant do problem solving i can understand dsa topics pretty easily but cp feels very hard to me like this year codevita questions like orchard , vip cafe , maze runner i could not figure out them im really ashamed of myself