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

preview_player
Показать описание
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

******************************************
See Complete Playlists:

************************************************

Connect & Contact Me:

#datastructures
#linkedlistindatastructure
#algorithms
#dsa
Рекомендации по теме
Комментарии
Автор

CORRECTION: 1) In delfrombeg() function we will write one more condition to check whether there is only one node in the list :
if(head->next==0)
{ head=0;
free(temp);
}
2) in delfrompos() function check for corner case (if position is 1 then call delfrombeg() function):
if(pos==1)
{ delfrombeg();
}
Also check for invalid position by finding the length of the list.(This case I have discussed in deletion from circular linked list video)

JennyslecturesCSIT
Автор

Clear and neat explaination months of class solved in one day😅😅😅🤩🤩🤩🤩

kpandeeswari
Автор

The singly Linked list was discussed by my college professors and tuition teacher at least 4 or 5 times still there was confusion. But now it is so clear within one day. Thank you ma'am 🙇

Strawberry
Автор

it took me 2years to clear my doubts about linked list.thank you so much ma'am.

madhulekhahazra
Автор

You are doing such a great work.I was confusing at every step but your explanation made me everything clear.Thankyou for your existence

sarab
Автор

Best way of explanation. I ❤️ the way. I have seen many teachers's video but no one can teach like this.

veercreation
Автор

I first listen to the concept and try on my own to code. And yeah it works! 😄 Such a good explanation Didi.
Also consider my request making a playlist dedicated to 'Linux Kernel internals'. Not just concepts, but programs also. I see there's no solid work created for Kernel internals in YouTube.
Thank you!

prasannasrinivasan
Автор

Thank you ma'am for your excellent explanation. I'm following your all videos on DS and It is really helping me to clear my concept from scratch. Thank you again 😊

shreyabanik
Автор

What a explanation madam everyone without any basics will also understand your lectures .Thank you mam 🙏🙏

iasaspirant
Автор

One of the best way to explain these all

ntrahulkumar
Автор

damn, You are good :) I was struggling through the link list many many times. thank you for the clearing. you are gorgeous and brainy :) regards from Sri Lanka!

motogrip
Автор

i attended class and did not understand about linked list then i have seen your videos and now m really good at it. thank you

mobindiwan
Автор

I think you are great teacher thanks alot. You thought far much better than my lecturer in class.

stephenmuiru
Автор

Thankyou Ma'am So much . ❤❤❤
I am taking stress for DSA subject 😢.
But after attending your lecture it seems like DIL GARDEN GARDEN HO GYA.
Full respect ma'am.
गुरु ब्रह्मा गुरु विष्णु गुरु देवो महेश्वरा:
गुरु साक्षात परम ब्रम्ह तस्मे श्री गुरवे नमः

rahulbelwal
Автор

Unable to stop commenting this video excellent explaining keep it up thanks for the upload😍😍

udaytejareddypingili
Автор

Crystal clear explanation mam 💝💝 thanks a lot ...hats off to your hardwork ..👏👏✨💝😍

kalaivani
Автор

//code for single linked list
#include <stdio.h>
#include <stdlib.h>
void creation();
void display();
void insertion();
void deletion();
void search();
int length();
struct node
{
int data;
struct node *next;
};
struct node *temp, *newnode, *head, *nextnode;
int main()
{
int ch;
while(1)
{
scanf("%d", &ch);
switch(ch)
{
case 1:creation();
break;
case 2:display();
break;
case 3:insertion();
break;
case 4:deletion();
break;
case 5:search();
break;
case 7:exit(0);
break;
default:printf("Invalid Choice");
}

}
}
void creation()
{
int x=1;
head=NULL;
while(x)
{

newnode=(struct node *)malloc(sizeof(struct node));
printf("Enter Data: ");
scanf("%d", &newnode->data);
newnode->next=0;
if(head==NULL)
temp=head=newnode;
else
{
temp->next=newnode;
temp=newnode;
}
printf("Enter 0 to stop or 1 to continue\n");
scanf("%d", &x);
}
}

void display()
{
temp=head;
while(temp!=NULL)
{
printf("%d ", temp->data);
temp=temp->next;
}
}
void insertion()
{
int pos, i=1, x;
x=length();
temp=head;
printf("Enter position ");
scanf("%d", &pos);
if(pos>x)
printf("Invalid Positon");
else
{
while(i<pos)
{
temp=temp->next;
i++;
}
newnode=(struct node *)malloc(sizeof(struct node));
printf("Enter Data: ");
scanf("%d", &newnode->data);
newnode->next=temp->next;
temp->next=newnode;

}
}
void deletion()
{

int pos, i=1, y;
y=length();
temp=head;
printf("Enter Position ");
scanf("%d", &pos);
if(pos>y)
printf("Invalid Position");
else
{
while(i<pos-1)
{
temp=temp->next;
i++;
}
nextnode=temp->next;
temp->next=nextnode->next;
free(nextnode);

}

}
void search()
{
int key, flag=0;
temp=head;
printf("Enter key: ");
scanf("%d", &key);
while(temp!=NULL)
{
if(temp->data==key)
{
flag=1;
}
temp=temp->next;
}
if(flag==1)
printf("Key is found");
else
printf("Key is not found");
}
int length()
{
int count=0;
temp=head;
while(temp!=NULL)
{
count++;
temp=temp->next;
}
return count;
}

saiakshagn
Автор

Mam....hatsoff to u mam🤗🤗🤗🤗it's better to spend a week with ur lectures rather than attending college lectures....neat and clear explanation...great effect mam

kpandeeswari
Автор

mam you are of of the best teacher, the way you explain, no one can
thank you so much.

mitanshi
Автор

I always wait for ur video u are my favourite

aishwaryaghosh