title
2.6 Deletion of a node from Linked List (from beginning, end, specified position) | DSA Tutorials

description
In this video we have written a C program for Deletion operation in Linked List. We have discussed how to delete a node form singly linked list (from beginning, from end, from given position) with examples. and with Code DSA Full Course: https: https://www.youtube.com/playlist?list=PLdo5W4Nhv31bbKJzrsKfMpo_grxuLl8LU ****************************************** See Complete Playlists: C Programming Course: https://www.youtube.com/playlist?list=PLdo5W4Nhv31a8UcMN9-35ghv8qyFWD9_S C++ Programming: https://www.youtube.com/playlist?list=PLdo5W4Nhv31YU5Wx1dopka58teWP9aCee Python Full Course: https://www.youtube.com/playlist?list=PLdo5W4Nhv31bZSiqiOL5ta39vSnBxpOPT Printing Pattern in C: https://www.youtube.com/playlist?list=PLdo5W4Nhv31Yu1igxTE2x0aeShbKtVcCy DAA Course: https://www.youtube.com/playlist?list=PLdo5W4Nhv31ZTn2P9vF02bkb3SC8uiUUn Placement Series: https://www.youtube.com/playlist?list=PLdo5W4Nhv31YvlDpJhvOYbM9Ap8UypgEy Dynamic Programming: https://www.youtube.com/playlist?list=PLdo5W4Nhv31aBrJE1WS4MR9LRfbmZrAQu Operating Systems: //www.youtube.com/playlist?list=PLdo5W4Nhv31a5ucW_S1K3-x6ztBRD-PNa DBMS: https://www.youtube.com/playlist?list=PLdo5W4Nhv31b33kF46f9aFjoJPOkdlsRc ************************************************ Connect & Contact Me: Facebook: https://www.facebook.com/Jennys-Lectures-CSIT-Netjrf-316814368950701/ Quora: https://www.quora.com/profile/Jayanti-Khatri-Lamba Instagram: https://www.instagram.com/jayantikhatrilamba/ #datastructures #linkedlistindatastructure #algorithms #dsa

detail
{'title': '2.6 Deletion of a node from Linked List (from beginning, end, specified position) | DSA Tutorials', 'heatmap': [{'end': 879.367, 'start': 823.274, 'weight': 0.979}], 'summary': 'Covers various aspects of linked list operations and deletion, focusing on creating, updating, and freeing memory for nodes, with specific emphasis on deletion from beginning, end, and specified position, and discusses the time complexity of the operations.', 'chapters': [{'end': 37.374, 'segs': [{'end': 37.374, 'src': 'embed', 'start': 0.189, 'weight': 0, 'content': [{'end': 4.693, 'text': 'button. you can check out there and we have already discussed implementation of linked list.', 'start': 0.189, 'duration': 4.504}, {'end': 9.176, 'text': 'also how to create these nodes, fine and how to traverse the linked list.', 'start': 4.693, 'duration': 4.483}, {'end': 12.839, 'text': 'or you can say how to display the nodes, the data in the nodes.', 'start': 9.176, 'duration': 3.663}, {'end': 14.761, 'text': 'fine, how to display that data.', 'start': 12.839, 'duration': 1.922}, {'end': 16.001, 'text': 'so you can check out that video.', 'start': 14.761, 'duration': 1.24}, {'end': 18.804, 'text': "i'll provide you the link of that video in the description box here.", 'start': 16.001, 'duration': 2.803}, {'end': 22.607, 'text': "in this video i'm going to talk about only the delete operations.", 'start': 18.804, 'duration': 3.803}, {'end': 26.429, 'text': 'i assume that you have already created a list.', 'start': 23.408, 'duration': 3.021}, {'end': 30.911, 'text': 'fine this list and we are having four nodes in this list, right.', 'start': 26.429, 'duration': 4.482}, {'end': 37.374, 'text': 'so if you want to write down a program so you can implement these five function in the program, first of all, create list.', 'start': 30.911, 'duration': 6.463}], 'summary': 'The video discusses implementation and operations of linked lists, including creating nodes and displaying data, with a focus on delete operations.', 'duration': 37.185, 'max_score': 0.189, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg189.jpg'}], 'start': 0.189, 'title': 'Linked list: delete operations', 'summary': 'Discusses the implementation of linked list, creation of nodes, traversal of linked list, and how to display the data in the nodes, with a specific focus on delete operations, assuming the existence of a list with four nodes.', 'chapters': [{'end': 37.374, 'start': 0.189, 'title': 'Linked list: delete operations', 'summary': 'Discusses the implementation of linked list, creation of nodes, traversal of linked list, and how to display the data in the nodes, with a specific focus on delete operations, assuming the existence of a list with four nodes.', 'duration': 37.185, 'highlights': ['The chapter discusses the implementation of linked list, creation of nodes, traversal of linked list, and how to display the data in the nodes.', 'Specific focus on delete operations assuming the existence of a list with four nodes.', 'The video provides a link to a tutorial covering the implementation of a linked list and the display of node data.']}], 'duration': 37.185, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg189.jpg', 'highlights': ['Specific focus on delete operations assuming the existence of a list with four nodes.', 'The chapter discusses the implementation of linked list, creation of nodes, traversal of linked list, and how to display the data in the nodes.', 'The video provides a link to a tutorial covering the implementation of a linked list and the display of node data.']}, {'end': 515.128, 'segs': [{'end': 115.266, 'src': 'embed', 'start': 53.724, 'weight': 0, 'content': [{'end': 61.011, 'text': "so i'm going to write down code for these functions only fine, and you can call these function in the main function.", 'start': 53.724, 'duration': 7.287}, {'end': 69.519, 'text': 'fine. so now, as we know how to represent this node in the list, how to declare that data type that is a struct node.', 'start': 61.011, 'duration': 8.508}, {'end': 74.304, 'text': "we have already discussed many times in the previous video, so i'm simply writing that thing here.", 'start': 69.519, 'duration': 4.785}, {'end': 81.608, 'text': 'so this is how we are going to declare the data type that is struct node for this node data part and this next,', 'start': 74.884, 'duration': 6.724}, {'end': 83.949, 'text': 'this this is going to contain address of the next node.', 'start': 81.608, 'duration': 2.341}, {'end': 85.91, 'text': 'this is how we are going to declare this.', 'start': 83.949, 'duration': 1.961}, {'end': 87.751, 'text': 'why i am writing like this?', 'start': 85.91, 'duration': 1.841}, {'end': 93.134, 'text': 'we have already discussed you can check out that video one also this head pointer we are going to maintain,', 'start': 87.751, 'duration': 5.383}, {'end': 99.778, 'text': 'because in when we are performing the operation on link list, then we have only we have with us only this head.', 'start': 93.134, 'duration': 6.644}, {'end': 101.699, 'text': 'pointer means the address of the starting node.', 'start': 99.778, 'duration': 1.921}, {'end': 108.623, 'text': 'so we are going to create a pointer head and this pointer is pointer to node, pointer to node.', 'start': 102.259, 'duration': 6.364}, {'end': 110.244, 'text': 'see type is struct node.', 'start': 108.623, 'duration': 1.621}, {'end': 115.266, 'text': 'fine, now you can write down the coding for this create list and for this display.', 'start': 110.244, 'duration': 5.022}], 'summary': 'Code functions for struct node, declare data type, maintain head pointer.', 'duration': 61.542, 'max_score': 53.724, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg53724.jpg'}], 'start': 37.374, 'title': 'Linked list operations', 'summary': 'Covers the overview and operations of linked lists, including declaring a struct node, maintaining a head pointer, creating and deleting nodes, along with the process of deleting nodes, freeing memory, and addressing empty list scenarios.', 'chapters': [{'end': 143.742, 'start': 37.374, 'title': 'Linked list operations overview', 'summary': 'Covers how to declare a struct node, maintain a head pointer for a linked list, and perform operations such as creating a list and deleting nodes, as discussed in the previous video.', 'duration': 106.368, 'highlights': ['The chapter explains how to declare the struct node and maintain the head pointer for a linked list.', 'It covers the operations of creating a list and deleting nodes, providing a comprehensive overview of linked list operations.', 'The chapter emphasizes building upon previous discussions and focuses on key operations for linked lists.']}, {'end': 515.128, 'start': 143.742, 'title': 'Deleting nodes from linked list', 'summary': 'Explains the process of deleting nodes from a linked list, including the necessity of freeing memory after detaching a node, using pointers to access and delete nodes, and addressing the scenario of an empty list, with pointers being a crucial part of the deletion process.', 'duration': 371.386, 'highlights': ["When deleting a node from a linked list, it is necessary to free the memory allocated to the node, which is a crucial resource in the system, using the 'free' function with a pointer to the node, emphasizing the importance of managing memory resources. ", "In the process of deleting a node, maintaining a pointer to the node is essential, enabling the use of the 'free' function with the pointer to access and delete the node, emphasizing the importance of pointer management in the deletion process. ", "Addressing the scenario of an empty list, it is important to incorporate a check for an empty list before attempting node deletion, ensuring that the deletion process is executed appropriately based on the list's status. "]}], 'duration': 477.754, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg37374.jpg', 'highlights': ['The chapter provides a comprehensive overview of linked list operations, including declaring a struct node and maintaining the head pointer.', "When deleting a node from a linked list, it is crucial to free the memory allocated to the node using the 'free' function with a pointer to the node, emphasizing the importance of managing memory resources.", "Addressing the scenario of an empty list, it is important to incorporate a check for an empty list before attempting node deletion, ensuring that the deletion process is executed appropriately based on the list's status."]}, {'end': 673.606, 'segs': [{'end': 545.695, 'src': 'embed', 'start': 515.128, 'weight': 2, 'content': [{'end': 518.529, 'text': 'you can say free temp and this memory is to be freed.', 'start': 515.128, 'duration': 3.401}, {'end': 524.47, 'text': 'but now, before making this memory free, you have to update this thing.', 'start': 518.529, 'duration': 5.941}, {'end': 527.571, 'text': 'you have to store here zero.', 'start': 524.47, 'duration': 3.101}, {'end': 531.792, 'text': 'now how you can access this part of this node.', 'start': 527.571, 'duration': 4.221}, {'end': 535.687, 'text': 'obviously you can access only using a pointer.', 'start': 532.805, 'duration': 2.882}, {'end': 537.569, 'text': 'you cannot directly access this thing.', 'start': 535.687, 'duration': 1.882}, {'end': 540.231, 'text': 'but here no pointer.', 'start': 537.569, 'duration': 2.662}, {'end': 542.953, 'text': 'is there pointing this node?', 'start': 540.231, 'duration': 2.722}, {'end': 545.695, 'text': 'then how you can update this thing?', 'start': 542.953, 'duration': 2.742}], 'summary': 'Before freeing memory, update it with zero. access using pointer.', 'duration': 30.567, 'max_score': 515.128, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg515128.jpg'}, {'end': 648.986, 'src': 'embed', 'start': 620.265, 'weight': 0, 'content': [{'end': 622.488, 'text': 'so you can free that location from here only.', 'start': 620.265, 'duration': 2.223}, {'end': 624.009, 'text': 'so there are many ways.', 'start': 622.488, 'duration': 1.521}, {'end': 627.092, 'text': 'it is just one way out of all the possible ways.', 'start': 624.009, 'duration': 3.083}, {'end': 630.977, 'text': "fine, i'm not saying that this is the only way you can delete this thing.", 'start': 627.092, 'duration': 3.885}, {'end': 634.822, 'text': 'fine, now here we have to maintain two pointers.', 'start': 630.977, 'duration': 3.845}, {'end': 639.983, 'text': 'so one pointer, you can say this temp, another pointer, previous node, you have to declare that pointer.', 'start': 634.822, 'duration': 5.161}, {'end': 644.585, 'text': 'so here i am going to declare that thing.', 'start': 639.983, 'duration': 4.602}, {'end': 648.986, 'text': 'struct node.', 'start': 644.585, 'duration': 4.401}], 'summary': 'Exploring multiple ways to delete a location; maintaining two pointers: temp and previous node.', 'duration': 28.721, 'max_score': 620.265, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg620265.jpg'}], 'start': 515.128, 'title': 'Deleting node from linked list', 'summary': 'Discusses the process of deleting a node from a linked list, emphasizing the need to maintain two pointers for updating and freeing memory, highlighting the sequential access and alternative methods for deletion.', 'chapters': [{'end': 673.606, 'start': 515.128, 'title': 'Deleting node from linked list', 'summary': 'Discusses the process of deleting a node from a linked list, emphasizing the need to maintain two pointers for updating and freeing memory, highlighting the sequential access and alternative methods for deletion.', 'duration': 158.478, 'highlights': ['Maintaining two pointers, one for freeing memory and another for updating the node, is essential in the process of deleting a node from a linked list.', 'Sequential access is emphasized as the only way to traverse the linked list, with pointers initially pointing to the node being deleted.', 'Alternative methods for deletion are mentioned, such as directly accessing the next node or using different logic for deletion.']}], 'duration': 158.478, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg515128.jpg', 'highlights': ['Maintaining two pointers, one for freeing memory and another for updating the node, is essential in the process of deleting a node from a linked list.', 'Sequential access is emphasized as the only way to traverse the linked list, with pointers initially pointing to the node being deleted.', 'Alternative methods for deletion are mentioned, such as directly accessing the next node or using different logic for deletion.']}, {'end': 973.651, 'segs': [{'end': 731.039, 'src': 'embed', 'start': 707.679, 'weight': 4, 'content': [{'end': 714.385, 'text': 'so in previous node you will store temp and after storing this value you are going to move this temp.', 'start': 707.679, 'duration': 6.706}, {'end': 717.367, 'text': 'temp is equal to temp of next.', 'start': 714.385, 'duration': 2.982}, {'end': 720.31, 'text': 'now, see the working of this while loop.', 'start': 717.367, 'duration': 2.943}, {'end': 722.512, 'text': 'see temp of next not equal to null.', 'start': 720.31, 'duration': 2.202}, {'end': 723.452, 'text': 'temp is having 200.', 'start': 722.512, 'duration': 0.94}, {'end': 725.654, 'text': 'so using this you can access this node.', 'start': 723.452, 'duration': 2.202}, {'end': 727.075, 'text': 'temp next means 300.', 'start': 725.654, 'duration': 1.421}, {'end': 729.537, 'text': '300 is not equal to 0.', 'start': 727.075, 'duration': 2.462}, {'end': 731.039, 'text': 'it means we are going to enter into this loop.', 'start': 729.537, 'duration': 1.502}], 'summary': 'Using a while loop to iterate through nodes with specific values, such as 200 and 300.', 'duration': 23.36, 'max_score': 707.679, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg707679.jpg'}, {'end': 781.485, 'src': 'embed', 'start': 755.458, 'weight': 5, 'content': [{'end': 760.146, 'text': 'second node, fine, now again, see temp next not equal to null.', 'start': 755.458, 'duration': 4.688}, {'end': 762.187, 'text': 'temp next means 400.', 'start': 760.146, 'duration': 2.041}, {'end': 766.39, 'text': 'fine, now 300 you can access using 300 in this node.', 'start': 762.187, 'duration': 4.203}, {'end': 767.811, 'text': 'now temp next is 400.', 'start': 766.39, 'duration': 1.421}, {'end': 769.253, 'text': '400 is not equal to null.', 'start': 767.811, 'duration': 1.442}, {'end': 772.415, 'text': 'so again, control will enter into this loop now again.', 'start': 769.253, 'duration': 3.162}, {'end': 776.158, 'text': 'first of all, we are going to update this previous node in temp.', 'start': 772.415, 'duration': 3.743}, {'end': 778.239, 'text': 'we have 300 that is going to store in previous node.', 'start': 776.158, 'duration': 2.081}, {'end': 781.485, 'text': 'so now here we will store 300.', 'start': 778.239, 'duration': 3.246}], 'summary': 'Updating previous node with 300, accessing data using 300.', 'duration': 26.027, 'max_score': 755.458, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg755458.jpg'}, {'end': 879.367, 'src': 'heatmap', 'start': 823.274, 'weight': 0.979, 'content': [{'end': 824.154, 'text': 'so no problem is there.', 'start': 823.274, 'duration': 0.88}, {'end': 828.558, 'text': 'we can update this pointer easily and you can free this node easily, fine.', 'start': 824.154, 'duration': 4.404}, {'end': 838.52, 'text': 'so now, if you want to check out if you can write down a head, if condition, if this temp is equal to, is equal to head,', 'start': 828.558, 'duration': 9.962}, {'end': 841.08, 'text': 'means temp is still pointing to the first node.', 'start': 838.52, 'duration': 2.56}, {'end': 842.921, 'text': 'it means we have only one node in the list.', 'start': 841.08, 'duration': 1.841}, {'end': 846.062, 'text': 'so you can simply write down head is equal to zero.', 'start': 842.921, 'duration': 3.141}, {'end': 846.982, 'text': 'so you can write down.', 'start': 846.062, 'duration': 0.92}, {'end': 849.323, 'text': 'if you want, you can write down one.', 'start': 846.982, 'duration': 2.341}, {'end': 857.265, 'text': 'if condition, if temp is equal to, is equal to head in head you can store null.', 'start': 849.323, 'duration': 7.942}, {'end': 858.846, 'text': 'means head is not pointing anywhere.', 'start': 857.265, 'duration': 1.581}, {'end': 862.137, 'text': 'you have detached that node from the list.', 'start': 858.846, 'duration': 3.291}, {'end': 865.899, 'text': 'you have deleted that node, but you have to free that node.', 'start': 862.137, 'duration': 3.762}, {'end': 868.1, 'text': 'you have to take care of that thing, that thing also.', 'start': 865.899, 'duration': 2.201}, {'end': 876.545, 'text': 'so here you will write what free temp, fine or in else part what you can write.', 'start': 868.1, 'duration': 8.445}, {'end': 879.367, 'text': 'see now, here we have to store zero.', 'start': 876.545, 'duration': 2.822}], 'summary': 'Updating and freeing nodes in a linked list with if conditions for node deletion and memory deallocation.', 'duration': 56.093, 'max_score': 823.274, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg823274.jpg'}, {'end': 849.323, 'src': 'embed', 'start': 828.558, 'weight': 3, 'content': [{'end': 838.52, 'text': 'so now, if you want to check out if you can write down a head, if condition, if this temp is equal to, is equal to head,', 'start': 828.558, 'duration': 9.962}, {'end': 841.08, 'text': 'means temp is still pointing to the first node.', 'start': 838.52, 'duration': 2.56}, {'end': 842.921, 'text': 'it means we have only one node in the list.', 'start': 841.08, 'duration': 1.841}, {'end': 846.062, 'text': 'so you can simply write down head is equal to zero.', 'start': 842.921, 'duration': 3.141}, {'end': 846.982, 'text': 'so you can write down.', 'start': 846.062, 'duration': 0.92}, {'end': 849.323, 'text': 'if you want, you can write down one.', 'start': 846.982, 'duration': 2.341}], 'summary': 'Explanation of checking and assigning value to head and temp in a linked list.', 'duration': 20.765, 'max_score': 828.558, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg828558.jpg'}, {'end': 973.651, 'src': 'embed', 'start': 934.732, 'weight': 0, 'content': [{'end': 941.617, 'text': 'and this condition is this statement is going to be executed, that is free temp, and if control will not enter into if block,', 'start': 934.732, 'duration': 6.885}, {'end': 945.68, 'text': 'then it will enter into else block, and after else also, this statement is going to be executed.', 'start': 941.617, 'duration': 4.063}, {'end': 949.563, 'text': 'so, rather than writing twice, you can simply write down this after this else block.', 'start': 945.68, 'duration': 3.883}, {'end': 952.566, 'text': 'so this is how we are going to delete data from the end.', 'start': 949.563, 'duration': 3.003}, {'end': 959.795, 'text': 'fine, and you can call this function into main function and after calling this, you can call what display function.', 'start': 953.126, 'duration': 6.669}, {'end': 963.199, 'text': 'fine, you can display the list and what is going to be displayed.', 'start': 959.795, 'duration': 3.404}, {'end': 967.388, 'text': '3 and 9, because this is now not there in the list.', 'start': 963.199, 'duration': 4.189}, {'end': 970.07, 'text': 'we have only two nodes in the list.', 'start': 967.388, 'duration': 2.682}, {'end': 973.651, 'text': 'now we will delete a node from any specified position.', 'start': 970.07, 'duration': 3.581}], 'summary': 'The transcript discusses deleting data from a list and displays the resulting list with 2 nodes remaining.', 'duration': 38.919, 'max_score': 934.732, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg934732.jpg'}], 'start': 673.606, 'title': 'Linked list operations', 'summary': 'Explains the while loop in the context of a linked list, using specific node values such as 200, 300, and 400. it also covers deleting a node from the end of a linked list, including handling scenarios of deleting the only node, updating pointers, and efficient memory management.', 'chapters': [{'end': 807.5, 'start': 673.606, 'title': 'Linked list while loop explanation', 'summary': 'Explains the working of a while loop in the context of a linked list, emphasizing the process of updating previous nodes and moving through the list, using specific node values such as 200, 300, and 400.', 'duration': 133.894, 'highlights': ["The while loop is used to iterate through the linked list until the 'temp' of next is equal to 0 or null, requiring the maintenance of the previous node and simultaneous movement of both pointers.", "The process involves updating the previous node with the value of 'temp', followed by moving 'temp' to 'temp' of next, as demonstrated with specific node values such as 200, 300, and 400.", "The explanation focuses on the specific values and conditions encountered during the while loop iteration, such as accessing nodes using 'temp next' and checking for equality with 0 or null."]}, {'end': 973.651, 'start': 807.5, 'title': 'Deleting node from end', 'summary': 'Explains the process of deleting a node from the end of a linked list, including handling scenarios of deleting the only node, updating pointers, and efficient memory management. it also emphasizes the importance of avoiding redundant code for freeing memory.', 'duration': 166.151, 'highlights': ['The process involves checking if the node to be deleted is the only node in the list, updating pointers, freeing memory, and avoiding redundant code for freeing memory.', 'It explains how to handle the scenario when the node to be deleted is the only node in the list, and emphasizes the importance of efficient memory management by avoiding redundant code for freeing memory.', 'After deleting the node from the end, the function can be called in the main function followed by the display function to verify the updated list contents.']}], 'duration': 300.045, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg673606.jpg', 'highlights': ["The while loop is used to iterate through the linked list until the 'temp' of next is equal to 0 or null, requiring the maintenance of the previous node and simultaneous movement of both pointers.", "The process involves updating the previous node with the value of 'temp', followed by moving 'temp' to 'temp' of next, as demonstrated with specific node values such as 200, 300, and 400.", "The explanation focuses on the specific values and conditions encountered during the while loop iteration, such as accessing nodes using 'temp next' and checking for equality with 0 or null.", 'The process involves checking if the node to be deleted is the only node in the list, updating pointers, freeing memory, and avoiding redundant code for freeing memory.', 'It explains how to handle the scenario when the node to be deleted is the only node in the list, and emphasizes the importance of efficient memory management by avoiding redundant code for freeing memory.', 'After deleting the node from the end, the function can be called in the main function followed by the display function to verify the updated list contents.']}, {'end': 1553.597, 'segs': [{'end': 1524.717, 'src': 'embed', 'start': 1463.324, 'weight': 0, 'content': [{'end': 1470.548, 'text': 'fine. so now, if you talk about the time complexity, see in the previous case when we were deleting from the end.', 'start': 1463.324, 'duration': 7.224}, {'end': 1475.732, 'text': 'so you have to traverse the list till here, as we have seen.', 'start': 1470.548, 'duration': 5.184}, {'end': 1480.034, 'text': 'so time complexity would be, it depends on the number of node present in the list.', 'start': 1475.732, 'duration': 4.302}, {'end': 1482.255, 'text': 'that is order of n.', 'start': 1480.034, 'duration': 2.221}, {'end': 1489.3, 'text': 'this case we have already discussed when we were discussing the difference between array and linked list, that is order of n and from beginning.', 'start': 1482.255, 'duration': 7.045}, {'end': 1492.001, 'text': "if you want to delete, then you don't have to traverse the list.", 'start': 1489.3, 'duration': 2.701}, {'end': 1494.083, 'text': "it doesn't depend how many element in the list.", 'start': 1492.001, 'duration': 2.082}, {'end': 1496.805, 'text': 'you can simply delete this by updating this head.', 'start': 1494.083, 'duration': 2.722}, {'end': 1499.707, 'text': 'so in that case it was order of one only.', 'start': 1496.805, 'duration': 2.902}, {'end': 1505.03, 'text': 'and if you want to delete from any specified position, in that case also it is order of n.', 'start': 1499.707, 'duration': 5.323}, {'end': 1514.007, 'text': 'why? so see, if you want to delete from here, so you have traversed this and this two nodes, fine, so obviously it is.', 'start': 1505.03, 'duration': 8.977}, {'end': 1518.071, 'text': 'it is proportional to n only number of elements.', 'start': 1514.007, 'duration': 4.064}, {'end': 1522.355, 'text': 'fine, if you want to delete from the middle, then you have to traverse n by two elements.', 'start': 1518.071, 'duration': 4.284}, {'end': 1524.717, 'text': 'so it is proportional to n.', 'start': 1522.355, 'duration': 2.362}], 'summary': 'Time complexity for deleting from linked list varies from o(1) to o(n) depending on the position', 'duration': 61.393, 'max_score': 1463.324, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg1463324.jpg'}], 'start': 973.651, 'title': 'Deleting nodes from linked list', 'summary': 'Discusses the process of deleting nodes from a linked list, including the logic, pointer manipulation, and time complexity, with examples of deleting from the end, beginning, and specified position, resulting in time complexity of order of n and order of one, and a preview of upcoming topics including reversing a linked list and doubly linked list.', 'chapters': [{'end': 1553.597, 'start': 973.651, 'title': 'Deleting nodes from linked list', 'summary': 'Discusses the process of deleting nodes from a linked list, including the logic, pointer manipulation, and time complexity, with examples of deleting from the end, beginning, and specified position, resulting in time complexity of order of n and order of one, and a preview of upcoming topics including reversing a linked list and doubly linked list.', 'duration': 579.946, 'highlights': ['Deleting from the end requires traversing the entire list, resulting in time complexity of order of n. When deleting from the end, the list needs to be traversed, resulting in a time complexity of order of n.', 'Deleting from the specified position also has a time complexity of order of n due to the traversal required, which is proportional to the number of elements in the list. Deleting from a specified position involves traversing the list, resulting in a time complexity of order of n, which is proportional to the number of elements in the list.', 'Deleting from the beginning has a time complexity of order of one, as it only requires updating the head. When deleting from the beginning, the time complexity is order of one, as it only requires updating the head.']}], 'duration': 579.946, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ClvYytk5Rlg/pics/ClvYytk5Rlg973651.jpg', 'highlights': ['Deleting from the beginning has a time complexity of order of one, as it only requires updating the head.', 'Deleting from the specified position also has a time complexity of order of n due to the traversal required, which is proportional to the number of elements in the list.', 'Deleting from the end requires traversing the entire list, resulting in time complexity of order of n.']}], 'highlights': ['Specific focus on delete operations assuming the existence of a list with four nodes.', 'The chapter provides a comprehensive overview of linked list operations, including declaring a struct node and maintaining the head pointer.', 'Maintaining two pointers, one for freeing memory and another for updating the node, is essential in the process of deleting a node from a linked list.', "The while loop is used to iterate through the linked list until the 'temp' of next is equal to 0 or null, requiring the maintenance of the previous node and simultaneous movement of both pointers.", 'Deleting from the beginning has a time complexity of order of one, as it only requires updating the head.']}