your videos are the only ones on youtube that seem to explain the concepts of linked lists and pointers in a clear and concise way. invaluable help. thank you so much.
***** The second line doesn't make any sense. Firstly, you're trying to cast the return value of malloc (a void pointer) to a Node. You can't do that, they're different types. In C++ you need to cast it to a pointer of type Node* (as the first line does). This cast is not required if you're in vanilla C. Even if the right hand side was correct, you then would be trying to assign a pointer to a Node * to a Node. You can't do that for the same reason as above, they're two conflicting types. The whole point (lol) of malloc is that it returns to you a pointer to some memory out on the heap and therefore you can only ever assign the return value of malloc, to a pointer.
+Gaming News Sir I think , First statement is points to a void pointer variable allocated by dynamic memory allocation. but Second statement is a simple variable which is allocated by dynamic memory allocation and converted in node variable by using explicit type conversion.
to create a structure type variable, you have to use "struct" keyword. If you have a structure named Node, and if you declare a Node structure type pointer variable and then store another Node type structure variable into that( link), you have to use pointer to "Node type pointer variable" to access the stored "Node type structure" contents in that particular pointer variable(in this case Node type pointer variable "link"). Hope you understand.
I advise you to go on career teaching people coding and computer science. You would be winning top awards each year. Never in my life did I see better explanations than you videos. Your playlist only on Data Structures is worth at least 200 bucks as a course online :}
I recently discovered your videos. Many years ago I was a programmer with weak knowledge of data structures. Now, I've decided to gain a firm understanding of them. I've viewed several videos and am currently reading a book on the subject matter. You have managed to explain data structures so clearly that the seem so easy to understand. You are an outstanding teacher. Thanks for your videos.
I have been trying to understand the actual coding concept of linked lists for about a week. I searched through countless videos, help forums, asked friends and this video right here was the most informative, easy to grasp explanation I have seen. Thank you more than you know
Sir, you just helped save my student backside, may whatever gods you worship give you money, children, whatever you want. Your lesson is the only one, that helped me understand the idea behind linked lists. I guess i'm too stupid for any other source. >.
Thank you for creating this content. I am a computer science major that spent my first two years of college developing skills related to the humanities. To do so, I lost track of the stem framework. I lost the assumed or assimilated aspect of what makes a cs major a cs major. This video triggered the neurons I needed it to :)
i have seen many coding videos on RU-vid. but this channel has always provided me with the best explanations so far. thanks a lot for all your amazing videos.
Man..... i dont know how to thank you ... tomorrow i have practical exams and i could've learnt the code by heart and went but this explanation was just awesome can never forget this !! superb !!
THANK YOU SO MUCH! Your video is the only video that is short, concise and easy to understand! It is so much simpler to understand link list now! Thank you soo soo much :D
Omg I read multiple explanations of linked lists online and in a text book but I still couldn't grasp the logic behind it. But you did it (also thanks to previous video about memory). You have a gift of explaining clearly and easily! Thank you!
Thank you so much! I would want more advanced application examples on linked list if possible! Love video lecture because I can pause and think and work on the understanding before moving on. Learning-on-demand!
These videos are damn usefull...u are one of the best teacher here in youtube i have come acrossed....keep up the work...there are many students how need videos like these to enhance there skill!!! Thanks A LOT for your help REGARDS AYUSHEE TIWARI(M.P)
For those looking for java implementation. This can be converted easily to a generic implementation. public class LinkedList { private final Node head; public LinkedList() { head = new Node(); } // 1. Insert data. public void add(int data) { Node address = head; while(address.next != null) { address = address.next; } Node newNode = new Node(); address.next = newNode; newNode.data = data; } // 2. Traversal public void print() { Node address = head; if(address.next == null) { System.out.println("Empty"); return; } while(address.next != null) { System.out.println(address.next.data); address = address.next; } } /** * Private static inner class to create a node for the linked list. */ private static class Node { private int data; private Node next; } }
I am a bit confused at what is the node*? I know it means the pointer to node, so does node* mean “a pointer variable which stores the address of the next node”?
Did you managed to get out of that depression? Did you do something stupid? Are you still alive? Now seriously, for beginners: giving examples from 2 different *unknown* languages at the same time while grasping data structures, can be kinda confusing
I support this statement as a professional programmer. Second, for teaching to others it's not recommended to jumble. Just pick the best as they look completely upto you. Last, C++ for it's library functions support will always be preferred balanced language for competitive programming given that it has comparable speed to C.
I really felt in love with this channel the contents are very helpful before I hate this course in my college but for now I am really excited about thank a lot man for helping learners for free
Thanks for explain the implementation in C/C++ Other videos just explain the idea but not explain how the implementation looks like in C/C++. Thank you very much!
I am a computer science student and whenever I don't understand specific concepts in the data structure and algorithms, I will log in to my youtube account and then watch videos like this, finding that most of the professors in the university can only read PowerPoint which is lack of clarity and engagement. I do think that if professors can teach their students in this way, things will really get easier.
Why..just why..cannot (ANY) university professor explain it as simply as this guy..thank you so much.. explaining coudnt be made simpler ugh, amazing dude, amazing
Hi, thank you for this wonderful playlist to help programmers in their struggle to grasp these basic concepts ! Also, another thing, would it not be better to keep an "end" pointer at the end of the linked list each time we added an element at the end. That way it would be faster to add element at the end of the list..
hey, this video was very helpful for me to understand the syntactic flow of linked list and pointers. But I think there is a huge flaw in the step temp1->link = temp. Temp is pointing to the latest malloced memory, but when traversal, temp1 will stop a node before the final node, the node(can say node-1) whose link is NULL, that point where we want to stop. But this step will assign pointer of the last node not the second last one. If you think I am missing something and maybe wrong, please clarify. Thank you.
Hi, great vid.. I got i doubt here. Could we have used A directly instead of creating a temp varibale. Like the following instruction: A= (node*)malloc(sizeof(node)); before allocating values to the head node.
HEY my code school your tutorials are excellent. I have one doubt in this tutorial where we create a new temp1 variable. When we want to link the nodes why can we write temp->link=100. What is the purpose of creating the node*temp1 and how does the linking process take place with temp1. I am getting a little confuse. Please help
Thanks a lot. I have been following your videos for quite some time, and they have been the best help so far. All the concepts are explained in such a simple and easy to follow manner. With Linked List, is it possible for you to do it java for once. Any help or suggestions are much appreciated.
There is a problem with ur loop, which is the final node won't be accessible if the condition: while(temp !=NULL) then it will be correct! anyway thank u so much :o
Your set of videos are the best. I'm studying these concepts now, but it's hard for me to understand the use of these in real life. Am I ever actually going to use these concepts to develop software in the real world??
In this lesson you said the address of the head node is never modified, but we are actually modifying the head node to temp right. temp->data=2; temp>link=null; A = temp; Now the head node is pointed to the first block of memory
hey guys i tried to write these code in my computer. I use code blocks. And there is an error in the line Node* link; says that Node is uknown type name. But he already define in the struct Node right?
you explain things in a very good manner, the only problem that I faced was that you tend to explain things in both c++ and c..this kind of breaks the concentration for the viewer as he might not knw(not be interestd in either of the one) anything abt either c or may be c++..
Viral Tagdiwala It doesnt know what the struct node is until it's done being defined. You can avoid this by adding a predefinition of "struct node;" before your actual struct definition, or by just using struct node inside the struct.
I didn't saw the video yet, but I'm guessing you declare struct Node inside the List because you don't want to expose Node to the outside. After all, users shouldn't be able to declare an object of type Node, it is just an internal component of the List, and when you actually call functions on the List like "back()" or "front()" they actually return the value of that Node, which for a List is an 'int' and not a Node. Consider this: if you gave users access to Nodes, then they could mess up with the "next" pointer and break the whole thing, leaking part of the list in the process.
Inside the while loop at 11:17 shouldn't the condition just be temp1 != NULL. temp1->link points to the link that the next node stores. So if the linked list contains only the head and one node temp1->link is NULL because it is the last node and it will not go inside the while loop. So if we want to print the values inside the while loop it won't print anything in this case. Can anyone explain to me?