Mr. Animesh Nayan! You're gem of an instructor man, seriously. ❤️
@yashaswani88133 жыл бұрын
good to see another Aswani learning to code haha
@itsmejatin2565 Жыл бұрын
brother these content was not by animesh nayan but by lord harsha suryanaryaana known as humble fool
@MrPortraitsofpast9 жыл бұрын
this guy is so badass. Thorough, precise, not watered down, and still entertaining...dope.
@PHYSICSGURUSANTOSHYADAV9 жыл бұрын
Best lecture on internet about programming methodology...i havent seen ever such a clear explanation about each topics..really you all are doing such a great jobs..thank u so much sir....
@aaqif9111 жыл бұрын
Wouldn't have been able to perform as well as I am on my C programming course without your videos! You are awesome! Thank you for taking the time to do this.
@AZihad104 жыл бұрын
I don't usually go around praising yt tutorial makers but this visualization process is very cool. You have an unique way of teaching. Thanks and Good luck man
@3216mohit9 жыл бұрын
one of the best tutorial on list list... good work!!!!! first time i understand whats this shit is
@johnnychan67559 жыл бұрын
The simulation is excellent! It definitely has helped me visualize the algorithm better. Thank you!
@arunraj11s6 жыл бұрын
for (i=1;inext; } this would have avoided unnecessary confusions for beginner.
@VirtualCarExotics5 жыл бұрын
thx
@efstacrazydaisy5 жыл бұрын
I must say im not confused at all and not a beginner... by watching this video i feel like an expert! Congrats to the team behind it..love you India
@jossboloko5 жыл бұрын
your comment helped a lot
@bodhabhargav67095 жыл бұрын
Actually you would get a segmentation fault (core dumped) due to not properly allocating memory.
@kamalbhatt60415 жыл бұрын
if i want to insert my node at second position. Then n=2, the loop wont work for this since n-1=1 here. Please help
@georgemacintyre33338 жыл бұрын
I just want to say thank you so much. These videos are amazing. I understand linked lists so well thanks to these, and I've never seen a programming concept explained so well, not even from my teachers. You are the best!
@leenanaik38945 жыл бұрын
You have explained things very well. I had to watch it 4 to 5 times but it really worth it. Thank you so much.....!
@yichizhang7959 жыл бұрын
It is arguably one of the best quality programming video I have ever seen. Thank you so much for making this video. It really helped me out from link list! God bless you sir :)
@TheVictorEffect4 жыл бұрын
I'm studying for my finals right now and I'm just now learning my professor literally copied most of your videos to teach us C. Like the code in his slides are IDENTICAL from this tutorial. So funny yet sad I'm paying thousands of dollars when its free here
@sramaiah1107846 жыл бұрын
You guys are amazing. Very detailed and clear in explaining. Keep up the good work.
@ChildofDestiny227 жыл бұрын
Big thanks from Indonesia, this is no doubt one of the best programming tutorial in youtube, you explained things clearly! You deserve more subscribers!
@sakinebarati74483 жыл бұрын
it's very helpful and amazing for me,thank you so much,GOOD LUCK
@davidhasovic7 жыл бұрын
// Code in C with slightly clearer variable names in the main part of the program // To compile with gcc run this: "gcc -o linked_list2 linked_list2.c ; ./linked_list2" assuming that your file name is named: "linked_list2.c" #include #include struct Node { int data; struct Node* next; }; struct Node* head; void Print () { struct Node* temp = head; while (temp != NULL){ printf ("%d", temp->data); temp = temp->next; } printf(" "); } // The meat of the program void Insert (int data, int position) { struct Node* newNode = malloc(sizeof(struct Node)); newNode->data = data; newNode->next = NULL; if (position == 1) { newNode->next = head; head = newNode; return; } struct Node* previousNode = head; for (int i = 0; i < position - 2; i++) { previousNode = previousNode->next; } newNode->next = previousNode->next; previousNode->next = newNode; } int main () { head = NULL; Insert (2, 1); Insert (3, 2); Insert (4, 1); Insert (5, 2); Print (); }
@RownitaTasneem-qf5sr5 жыл бұрын
Thanks a million for your code.
@shubhambhardwaj28535 жыл бұрын
@@shyamsundarjha5913 Because We have Started taking Node 1 as position 1 not Position 0 and we have started for loop from i=0 and at When i will be at Position-2 Our temp2 will be at position-1 Which we need.If You will take i=1 then it will be upto pos-1.
@parthaprateempatra42784 жыл бұрын
@@shyamsundarjha5913 because you always start on the head node and not before it. So if we do n-2 then we are eliminating a iteration to arrive at the n-1 node
@suryadiptomukherjee74013 жыл бұрын
you did not typecast the malloc part buddy
@sainath79093 жыл бұрын
one of the best explained
@AmanKumar-nj5sz3 жыл бұрын
Literally the best
@priyankaradhakrishnan8949 жыл бұрын
thank you sir.initially felt data structures very difficult but gained more confidence after watching these videos.
@mycodeschool11 жыл бұрын
Well, in that case - you will not have to traverse the list from head. You will only adjust some links in constant time.
@sarveshdhar72135 жыл бұрын
you are like a god for me I have never seen this type explanation very nice
@vijaykumarkari4 жыл бұрын
wow! really amazing i learned inserting a node in linked list.thank you:)
@mycodeschool11 жыл бұрын
Thanks Prashant :)
@shrichede34636 жыл бұрын
for those who are confused about "n-2", just start your loop with i=1 (which means head n=1) then you can run your loop until "n-1" to avoid confusion.
@bhaswardutta84935 жыл бұрын
Thank you!! 🙏🙏🙏🙌
@convolutionalnn25824 жыл бұрын
@@bhaswardutta8493 if we wanna insert in 2 position n=2,so i
@archit19392 жыл бұрын
@@convolutionalnn2582 IN THAT CASE the loop will not run because we require temp2 to be at head position which it already is
@krushnnabaviskar21702 жыл бұрын
THank you for making this gem videos , i will definitely reach to my destination by watching this playlist.
@rahuldevlenka5055 жыл бұрын
here's the source code for c: #include #include void Insert(int, int); void print(); struct Node { int data; struct Node* next; }; struct Node* head; void main() { head=NULL; Insert(3,1); Insert(2,2); Insert(4,2); print(); } void Insert(int data, int n) { struct Node* temp1=(struct Node*)malloc(sizeof(struct Node*)); int i; temp1->data=data; temp1->next=NULL; if(n==1)//empty list { temp1->next=head; head=temp1; return; } struct Node* temp2=head; for(i=0;inext;//to point temp2 to (n-1)th node after loop } temp1->next=temp2->next;// point new (nth)node to next node temp2->next=temp1;// to point the previous( n-1 th) node to new node } void print() { struct Node* temp=head; while(temp!=NULL) { printf("%d\t",temp->data); temp=temp->next; } puts(""); }
@ankanmaiti98645 жыл бұрын
The same logic in c++ is not working
@МаоЦзэдун-б5с5 жыл бұрын
I have a question. About changing 1st item second time! Clearly that code is wrong, if i want to insert something at first position, this code will point my new node to head "temp1=>Next = head" and then assign head to my new node "head = temp1", which means that "head=>Next == head"(head points to itself), and if we had a data in our list then we would lose it and also have a unnecessary occupied space in our memory, cause C/C++ do not have something like garbage collector. Why do this pal? Something like "//empty list" means nothing in logic, you make your program work properly and you do not make comments asking to not do that second time,while in your example you do that for second time and show that code is working just fine. (i mean in this comment he didn't made that mistake but video author did)
@МаоЦзэдун-б5с5 жыл бұрын
@@ankanmaiti9864 do you face the same problem as i described? ^
@mingx00910 жыл бұрын
Very very clear lecturing. Thanks a lot.
@01aniruddhaislam26 Жыл бұрын
Very good tutorial. I wish he continued teaching like this.
@Sneaky1ne5 жыл бұрын
I'm very grateful for all these videos and I think it's hilarious that you put subtitles, even tho honestly I think it's better they are there. cheers :)
@sr57269 жыл бұрын
Thank you for the video. We should also take care of invalid position scenario... Eg.if list has just 3 nodes and user does insert( data=1 , n= 65 ), Inside for(i=0;inext; } will crash.. correct way is for(i=0;inext!=NULL ;i++) and node can be inserted at end. Similarly for empty list and invalid position , code can be changed to if (pos == 1 || (head == NULL && pos != 1) ) { newNode->next = head; head = newNode; return; }
@nikunjchapagain56547 жыл бұрын
if(temp2->link == NULL) { cout
@tembelihlemoyo35665 жыл бұрын
I got an exam in a weeks time but the way this guy is explaining,it has given me confidence that i can take the exam today,,,,,thumps high & fuck haters
@usama579266 жыл бұрын
thanks for such an amazing playlist
@ADNANAHMED-eo5xx4 жыл бұрын
wow this was confusing, but it was fun, because when u understand after confusion, it is understood better, thanxxxxxxxxxx
@Naveen-ef2dg6 жыл бұрын
Best possible way to learn datastructure is through this playlist... Well done sir
@arkapravadutta83196 жыл бұрын
First of all , amazing explanation. Doubt: 1. Why use the if statement at all when n=1, why not just use a while loop and do n--; 2. I am aware that it has something to do with not giving a position that does not exist in the list but i am still not clear as to why we are giving only 1 and 2 as the positions where we want to enter the numbers
@studentsolution674 Жыл бұрын
Should i share my code about linklist in C++. So i like the way you explain the things and i want to learn more from you.
@vijaykumarkari4 жыл бұрын
This video made my day..really awesome video to understand
@kandras3 жыл бұрын
THAT👉 temp2 = head 👈IS MY SAVIOR, THE REASON WHY IT ALWAYS "SEGMENTATION FAULT" great thanks to you man 👍
@abdulkayuem32477 жыл бұрын
Best lecture i have ever seen
@paulwatkin636010 жыл бұрын
My favouite quote in this video is "Head will not be accessible everywhere!", such is life lol! Great work though, really good video.
@vukstefanovic62757 жыл бұрын
your videos are great !!!!! its a shame u don;t make them any more :(
@md.mujtabaraza19196 жыл бұрын
Yeah, he died before completing his playlist :(
@jitu_jackjp95527 жыл бұрын
wonderful ......this is some special type of lacture......
@Otkucaji16 жыл бұрын
Sir, thank you very much for your help, i really appreciate it
@sukruthipattabi30045 жыл бұрын
Your videos are so clear ...thanks !! Which is that software u r using to run the code ? Can u link it or tel abt it ?
@ajit0rocks8 жыл бұрын
if your program is going to infinity loop or not working. Just make these Changes in the for loop in the insert function : for (int i = 1; i < n - 1; i++) { temp2=temp2->next; }
@MrLaggerjack7 жыл бұрын
still not working
@srikargajawada34726 жыл бұрын
me too facing issue here,can any one help me?
@aasimbaig017 жыл бұрын
this is easy to understand and explain :) void insert(int pos,int val) { //declaration Node *temp1=head; Node *temp=new Node; //inserting value temp->data=val; temp->next=NULL; if(pos==1){ temp->next=head; head=temp; return; } else{ for (int i=2;inext; } temp->next=temp1->next; temp1->next=temp; }
@itsmejatin2565 Жыл бұрын
salute lord harsha suryanaryana you will always remembered
@rohanprak5 жыл бұрын
WHO IS THE GUY BEHIND THIS AMAZING CHANNEL ?? (voice seems to be from) Indian English accent ) thanks a lot brother for making this channel and for explaining each and every possible query in detail
@alenp63357 жыл бұрын
great video, extremely helpful and understandable
@sabbirahmed8657 жыл бұрын
really very nice explanation.
@mashable87598 жыл бұрын
BEST LECTURE EVER
@abhinavthakur20654 жыл бұрын
Great explanation. Just one thing about process layout - It is ".code -> .data/.bss -> heap -> stack" rather than ".code -> .data/.bss -> stack -> heap" :)
@aswathyjagadeesh3 жыл бұрын
Thank You Sir!!!! superb explanation :))
@SahilAnsari-ix6mu8 жыл бұрын
Sir can i ask a personal question from where u have studied computer because your lectures are too good i want to download each and every lectures but it is taking much time so i m downloading one by one it is helping me a lot I am a first year btech Computer science student...
@himanshu64898 жыл бұрын
he has done his engineering from Netaji Subhash Institute of Technology, New Delhi.
@anshuman170255 жыл бұрын
@@himanshu6489 no. He has studied from IIIT, Allahabad.
@SpencerDean1411 жыл бұрын
Very helpful. Thanks for the video
@backgroundnoiselistener35997 жыл бұрын
great explaination dude.
@chilinouillesdepommesdeter8196 жыл бұрын
very good explanation!
@iwayanbagus22716 жыл бұрын
great explanation, thank you so much
@Hello_world8076 ай бұрын
Thank you my friend ❤❤❤
@reeshav9943 жыл бұрын
will this code work if try to insert at 3 rd position cause u have only done insertions at first and last node
@goreeska50145 жыл бұрын
Great series. I love your page. In the end however the value of head should be the address of 4 (which is 50 not 150) since head has changed.
@MahendraSingh-te3fm11 жыл бұрын
Excellent Buddy... Very Helpful.
@seewhatseeabc9 жыл бұрын
This guy is good!
@gauravkumarpandit70225 жыл бұрын
best tutorial.Thanks for this.I want to know the ide u r using
@shubhamgoswami87517 жыл бұрын
no any teachers explains in such a simple way...
@suyashschmidt69859 жыл бұрын
Explanation is great. Could you tell how are you writing this code? I mean what compiler? Xcode ?
@prashantrathi9911 жыл бұрын
Perfect !!!! awesome explanation ... keep it up !
@usama579266 жыл бұрын
amazing video amazing explanation
@piyushsharma16388 жыл бұрын
very well explained.
@SaadKhan-xd9yp9 жыл бұрын
Your videos are really helpful bro. Keep up the good work i m not sure that if you have another you tube channel called "NESO Academy" because last semester i was taking logic design and the videos really helped me to get the grade i wanted. But you guys sound alike. Let me know if that's your channel.
@deepankdixit75417 жыл бұрын
This is an excellent video. At least for me. Thank you very much. Someone please explain to me the difference between temp and (*temp).next .
@joshmagana39027 жыл бұрын
temp contain the adress of the node but temp->next contains the adress of the next one if we only have one node that means node = head so that node will take head adress and node->next = NULL since its pointing at nothing next
@deepankdixit75417 жыл бұрын
Thank you very much Josh Magana.
@mycodeschool11 жыл бұрын
Your code is not even compiling. Do not use conio.h and getch().. its not needed. And you have not written the case n==1 correctly. Check the code again.
@mrbam88 жыл бұрын
this is bad example for n-2 for loop... the next video explains it better. Rather than inserting at position 2 this video should have shown inserting at position 3. It would be more clear.
@rounabhsahu90246 жыл бұрын
It would be awsome if u answer or just reply to your kind youtubers watching ur video and asking doubts! BTW great video ___A bit confusion in loop part but otherwise all good!!
@ayushyadav40769 жыл бұрын
we will write struct Node* temp1 = (struct Node*)malloc(sizeof(struct Node*)) or struct Node* temp1 = (struct Node*)malloc(sizeof(struct Node))
@MaiPham-js2hq6 жыл бұрын
thanks for your help. I finally find out why the code doesn't run. phewww!!!
@h_25774 жыл бұрын
Great tutorial👍. Doubt: why didn't you deallocate memory..from heap..???
@harerimanaradjab45689 жыл бұрын
dude you are awesome!
@vikrant46666 жыл бұрын
gud job animesh
@adarshtodi11585 жыл бұрын
who animesh?
@girishchandrakuniyal9 жыл бұрын
which compiler are used in above videos?? it looks pretty good than turbo c..
@OscarElnecave7 жыл бұрын
What about using a typedef to declare the structure? thanks
@mustafagamal88188 жыл бұрын
First Thank you so much for this great explaining , second I'd like to ask some question please, why this program can't deal when n > 2 ? I've tried to deal with third or force place or any place greater than 2 it doesn't work still put the data in the second place ??
@shubhambhardwaj28535 жыл бұрын
It will work Just add temp1->next=NULL; in the last line of insertNode.For Some Reason this Program Was Going in Infinite Loop but it is okay with this addition.
@manishjoshi5399 жыл бұрын
why not (n-1) instead of (n-2) there ? struct Node* temp2 = (struct Node*)malloc(sizeof(struct Node*)); for(i=0;inext; }
@jaspreetpawa7 жыл бұрын
because i=0 corresponds to node1, i=1 to node2....... i=n-3 to node n-2. within the for loop, node n-2 carries address of node n-1. hence , at the end of the execution, temp2 stores address of node n-1. cheers!
@kanishkjain27677 жыл бұрын
how???? for n = 1 there is a separate condition but for n = 2 the loop will not work because i
@himanshuladia90997 жыл бұрын
You actually don't want to run the loop for n=2. Because the pointer is already at n-1 that is, 1st position.,
@bhaveshgupta38466 жыл бұрын
this confusion is because he is counting the first node as 1 instead of 0. so if you start counting from 1 and do : for(i=1;inext; } you should be fine :)
@toxiklogic6 жыл бұрын
Do you think this is odd? For a series on data structures in C, shouldn't we start counting at 0 for an Insert implementation?
@01aniruddhaislam26 Жыл бұрын
I think the heap illustration in 14:53 is incorrect . 150 is written under head but it shown to point to 50.
@parasmani85149 жыл бұрын
superb sir !!!
@HemantKumar-dl9wh6 жыл бұрын
why you take i=n-2 ?
@backgroundnoiselistener35997 жыл бұрын
the explanation was good. But I did not fully understand the part of insertion function. please explain the part in function insert() where you make a loop and set temp=temp->next.
@kyssl7 жыл бұрын
action ka'men that's a step to traverse a linked list.. Watch previous lectures or trace the whole loop yourself
@MrAkshatmahajan6 жыл бұрын
You gotta display the whole linked list right? What that line does is traverse thorough the list,it changes the address stored in temp and then in the next line you print temp -> data (whatever data that new address stored in temp is pointing to) for example if next address of temp or node is 100 temp = temp->next will set it to that address and then you can print that data via simple cout statment
@AnkushPareOfficial9 жыл бұрын
Sir,if we ask user to enter position for data and initially user enter position greater than 1 lets say 10. so how can we handle this situation???
@sandhyathugutla42287 жыл бұрын
how does for loop works in insertion???please explain
@foruvasanth3 жыл бұрын
awesome, what tool you are using for whiteboarding?
@mohitsharmagarg2 жыл бұрын
Days to complete Full DSA learning, Average?
@praveenmarandi63729 жыл бұрын
one of the best>>>>
@dominicvarghese79936 жыл бұрын
I could not understand the for loop used. can you explain it
@codewithruds74526 жыл бұрын
why is temp != NULL required?
@hailongzhao28878 жыл бұрын
Posting an implementation which uses the while loop as well as checks boundary conditions: /* Insert Node at a given position in a linked list head can be NULL First element in the linked list is at position 0 Node is defined as struct Node { int data; struct Node *next; } */ Node* InsertNth(Node *head, int data, int position) { Node *node = new Node; node->data = data; node->next = NULL; Node *prev = NULL; Node *current = head; int n = 0; while (n < position && current != NULL) { prev = current; current = current->next; n++; } if (prev == NULL) { node->next = head; return node; } prev->next = node; node->next = current; return head; }
@amaytrivedi8 жыл бұрын
Liked your video but can u tell me if we assign address of head node to the node we want in d place of head why are we doin temp->next=head and not simply temp=head;..Thankyou:)
@danimanabat57914 жыл бұрын
thanks a lot!!
@ahmedsafwat14607 жыл бұрын
Thanks for the great explanation ! but the code doesn't work although it compiles...have you tried it yourself?
@koulicksadhu76794 жыл бұрын
What you faced? It works pretty fine
@sumitbisht41613 жыл бұрын
Iam doing... for(int i=8/9/10...(any value); i
@mannambhavani42664 жыл бұрын
Sir u could go little slow, yet great explanation.
@kandy12497 жыл бұрын
before IF condition in insert function ... do we really need that " temp1->next =null "? because it's just an extra step we don't need to perform I think.
@mrbilalkhan7 жыл бұрын
If condition checks if the new entry is in the first position of the linked list. whereas temp1->next =null is placed outside the if block if in case the list is empty.