I have learnt so much and with daily practice, I am getting really good at programming. Thanks for every thing you have done Neso Academy
@RedMasterMorphiX2 жыл бұрын
Sir we really Need a teacher like you in our university. Such a beautiful representation and teaching. All my Doubts got cleared . Thank you so so much. And finally I will be able to attend my final exam tomorrow
@Reetesh6443 жыл бұрын
Best teacher ever ❤️❤️
@dipeshsamrawat79573 жыл бұрын
I love Neso Academy. 💝
@divyanshi7178 Жыл бұрын
the best ever explanation, gone through many videos of different channels but this one has cleared all my doubts, thank you sir
@Randomx7603 ай бұрын
The lecture covers the linked list implementation of stacks, focusing on the node structure and the push function. It explains creating a new node, updating pointers, and handling memory allocation. The final part demonstrates the complete code implementation and user interaction for pushing and printing stack elements. Highlights: 00:06 This lecture focuses on the linked list implementation of stacks, emphasizing the structure of nodes and the use of a top pointer instead of a top variable. Understanding these concepts is crucial for effective stack operations in C programming. -The push function code is critical for adding elements to the stack, ensuring that the linked list structure is maintained as elements are added. This function manipulates the top pointer. -The structure of the node is essential for representing elements in the stack, consisting of data and a link to the next node. This follows the singly linked list format. -Declaring a top pointer globally allows for easy access to the first node in the linked list, which is necessary for stack operations. This approach replaces the traditional top variable used in arrays. 02:25 The video explains how to implement a stack using a linked list in programming. It specifically focuses on the structure of nodes and the push function. -The structure of a node is crucial for creating a stack. The top pointer must be initialized to null, indicating an empty stack initially. -The push function for the stack is analogous to the add back function in singly linked lists. Small modifications are made to adapt it for stack operations. -When pushing a new element onto the stack, a new node with the corresponding value is added to the top. This ensures the stack's Last In First Out (LIFO) behavior. 04:43 Creating a new node in a linked list involves allocating memory and updating pointers. The new node's link must point to the current head of the list. -The first step in creating a new node is to allocate memory using the malloc function. This ensures that the new node has a designated space in memory. -After memory allocation, it's essential to set the data for the new node. In this case, the data is set to 50 before linking it to the list. -The link part of the new node must be updated to point to the existing first node. This is done using the top pointer to access that node's address. 07:02 The final step in implementing a stack's push function is to update the top pointer to point to the newly added node in the linked list. This ensures that the topmost element is always accessible for future operations. -Memory allocation is critical when creating a new node, as it uses the malloc function. If malloc returns null, it indicates a stack overflow due to insufficient memory. -An important check in the push function is to ensure that the new node is not null. This step prevents abnormal program termination due to stack overflow. -The push function is designed to add elements without returning any value, which is why its return type is void. This design simplifies the function's implementation within the stack structure. 09:21 The video demonstrates how to implement a simple stack using a linked list in C programming. It covers pushing, printing, and quitting operations in a user-interactive console application. -A temporary pointer is created to traverse and print elements of the linked list. This allows for easy access to each node's data until reaching the end. -The user is prompted to enter choices for stack operations, including pushing an element, printing the stack, or quitting the program. A switch case manages these user inputs effectively. -The stack's current elements are displayed after pushing new values, showing the last pushed element as the topmost. This demonstrates the Last In First Out (LIFO) property of stacks.
@eagiepal34703 жыл бұрын
Damn i barely can't understand my prof. explaining but in your video its easy. printf("Thanks Bro!");
@monicabattacharya64163 жыл бұрын
please complete this course fastly because there were queues , trees and graphs 📊😀 to complete. THEY MAY TAKE MORE TIME
@vengalrao57722 жыл бұрын
@encode decode hello bro where u have completed ? I need to learn !
@wog42992 жыл бұрын
@@vengalrao5772 where you learnt other topics ?
@vengalrao57722 жыл бұрын
I have skipped for nearly 2 months... Started since 10 days.. after that I feel code with Harry , mycode champ school... I can find the best
@vengalrao57722 жыл бұрын
@@wog4299 lemme know if any good resources !
@parvahuja76182 жыл бұрын
thanks to neso academy i am liking dsa again
@proadvices8592 Жыл бұрын
Thanks sir... I appreciate your work and time that u are giving too us really your way of teaching is really very nice... Thanks a lot...❤
@progos14852 жыл бұрын
Thank you so much sir. ❤
@gusionfusion10733 жыл бұрын
while using malloc at 5:38 shouldnt we write = malloc (sizeof(struct node)) ????? intead of malloc(sizeof(newNode))
@joegonzalez74343 жыл бұрын
You bring up a good point. malloc (sizeof(newNode)) would dynamically create memory the size of the node pointer. malloc (sizeof(struct node)) would dynamically create memory the size of the node itself. I think the latter is the way to go. It doesn't make sense why we are allocating memory the size of the node pointer and not the actual node. Hope someone can chime in on this some more.
@AbhinavKumar-qv7to2 жыл бұрын
@@joegonzalez7434 yes, its a mistake. It should be struct node as newnode is a pointer to the node.
@tusharkumar20772 жыл бұрын
@@joegonzalez7434 I think that newnode pointer might allocate the size of structure node because that pointe is just use for referring to the struct node so malloc will allocate the memory by reference
@tusharkumar20772 жыл бұрын
@@AbhinavKumar-qv7to think that newnode pointer might allocate the size of structure node because that pointe is just use for referring to the struct node so malloc will allocate the memory by reference
@Aditya_Ramakrishna214 ай бұрын
I had the same doubt
@suchithkumargm2 жыл бұрын
Sir can u continue this series with queue tree and graphs It's helping us a lot
@黃-i9h Жыл бұрын
Thank you so much!! I finally figured it out!
@progos14852 жыл бұрын
Really amazing👍😍😍
@nicoleshi50137 ай бұрын
Why do we have to put the newNode->link = NULL? Why not just newNode->link = top?
@samadhanpol72392 жыл бұрын
Nice presentation sir
@MrriamAddel2 ай бұрын
Thank you 🤍🤍🤍
@Mr_Memer01_ Жыл бұрын
Please make a video on quick Sort in DSA Please sir💯
@BhargavGajjala-x2p Жыл бұрын
Here also we are trying to change the top pointer and that change should be local to push function same as we discused in add beg function in linked list then how it is updating the top in pop function
@estelle98193 жыл бұрын
thank you so much for this
@Tech_BourA10 ай бұрын
Thanks for this explanation but I think there is a mistake in the complete function of push operation 7:35, you are missing the parameter "struct node **top" in the declaration, it should be "void push (int data, struct node **top)" instead of "void push (int data)" Correct if I am wrong, thank you.
@abhiraj20054 ай бұрын
you are wrong my friend, since the top pointer is globally declared, you need not to pass anything inside the parameter.
@abdelkaremhomidi7322 Жыл бұрын
THANK YOU SO MUCH
@tentohari Жыл бұрын
your awesome
@zainshah8042 ай бұрын
Where can i get that code
@abhishekmahor67002 жыл бұрын
I am hungry sir I want more content of data structure lite tree, graph.
@rajeshprajapati48633 жыл бұрын
❤️❤️❤️
@harshithashetty2332 жыл бұрын
Can u make a video about implementation of queue using linked list
@VikasKumar-tt8dz3 жыл бұрын
please complete the course asap....it is fun to learn🙂🙂🙂
@sujansasmal6657 Жыл бұрын
How can you perform push operation without creating a stack?
@ramya86692 жыл бұрын
The print function is not working my system
@raomubashir39762 жыл бұрын
I am getting error at malloc line the compiler showing error that a value of type"void"can't be assigned to an entity of type "node"
@joyatidas10162 жыл бұрын
requires type casting to structure type.
@smrpkrl Жыл бұрын
5:08
@sagnikkayal7822 жыл бұрын
but rather than a separate pointer 'top' ,why can't we just rename the 'head' pointer as 'top' ?