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

  Рет қаралды 666,833

Jenny's Lectures CS IT

Jenny's Lectures CS IT

Күн бұрын

Пікірлер: 363
@JennyslecturesCSIT
@JennyslecturesCSIT 5 жыл бұрын
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)
@khushwantmaan791
@khushwantmaan791 4 жыл бұрын
yes,that is great approach
@riyazquraishi8880
@riyazquraishi8880 4 жыл бұрын
Correction 1): not required.
@riyazquraishi8880
@riyazquraishi8880 4 жыл бұрын
head=head->next; Will work
@adityashinde8975
@adityashinde8975 4 жыл бұрын
int i = 1; while (i < pos - 1) { temp = temp->next; i++; } nextNode = temp->next; if (pos == 1) { head = nextNode; free(temp); } else { temp->next = nextNode->next; free(nextNode); } According to me, the only modification required is the one which I've written with if (pos == 0) and it's else part. Otherwise, the current code is good to go. I am assuming here the user has written a separate code for delete at the beginning.
@pg9645
@pg9645 4 жыл бұрын
MA'AM No.1) mein free(head) hoga na ?
@Strawberry12352
@Strawberry12352 2 жыл бұрын
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 🙇
@DurgaSaathwikKolla
@DurgaSaathwikKolla 8 ай бұрын
True 😢
@kpandeeswari6037
@kpandeeswari6037 4 жыл бұрын
Clear and neat explaination mam......3 months of class solved in one day😅😅😅🤩🤩🤩🤩
@bobitaschoice9585
@bobitaschoice9585 2 жыл бұрын
Ummm
@vipulkumar6059
@vipulkumar6059 9 ай бұрын
Ye link list itni tough kyu h 😮
@suyashmishra4521
@suyashmishra4521 2 ай бұрын
​@@vipulkumar6059teacher accha ho toh kuch tough nahi
@Chinni-246
@Chinni-246 Күн бұрын
Eppudu meru em chesthunaru
@atnas903
@atnas903 14 күн бұрын
After a five years of this video, i m watching now. Still nobody video is better than you. Bravo! Love from Bhutan 🇧🇹🇧🇹🇧🇹
@madhulekhahazra6096
@madhulekhahazra6096 4 жыл бұрын
it took me 2years to clear my doubts about linked list.thank you so much ma'am.
@asifiqbalsekh
@asifiqbalsekh 3 жыл бұрын
I agree that you feel proud to born in India. But we also feel that we are proud of that- excellent educator like you born In our country. Thank you, madam, you are great.
@saiakshagn3553
@saiakshagn3553 2 жыл бұрын
//code for single linked list #include #include 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 "); 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(inext; 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(inext; 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; }
@MrVrtex
@MrVrtex Жыл бұрын
Thank you brother
@nagasudhamr4574
@nagasudhamr4574 Жыл бұрын
Thank you 😊
@lifeahead5208
@lifeahead5208 Жыл бұрын
Hey how can I copy this?
@maytan8782
@maytan8782 Жыл бұрын
@@lifeahead5208for phone -> take screen shoot of comments //2->go to goggle and serach your screen shot then select text then u can copy that
@fedrickengels686
@fedrickengels686 7 ай бұрын
ai
@raginiroy9929
@raginiroy9929 7 ай бұрын
You're the best for all those are beginners within the world of DSA. .....I tried to understand Linked list many times specially create () ,struct node *...but always remain confused ,your explaination made me understand with ease. ..I hated Linked list but now I got it all...Thanking you a lot miss jenny: ))....keep up the great work ,I love all your video lectures more than any offline lecturer ..Thanks again ; :))
@iasaspirant1441
@iasaspirant1441 3 жыл бұрын
What a explanation madam everyone without any basics will also understand your lectures .Thank you mam 🙏🙏
@SUBHAJITBAG-os6zg
@SUBHAJITBAG-os6zg Жыл бұрын
0:00 Delete from beginning 6:18 Delete from end 16:15 Delete at position
@daisy_0-u4d
@daisy_0-u4d 22 күн бұрын
Thanks, u saved my precious time phew...🧠❤
@arthiannamalla5028
@arthiannamalla5028 9 ай бұрын
Mam you are my god you saved me whole night I'm holding my head while studying in textbook now in the morning I saw your video and understood so well
@stephenmuiru
@stephenmuiru Жыл бұрын
I think you are great teacher thanks alot. You thought far much better than my lecturer in class.
@aishwaryaghosh4329
@aishwaryaghosh4329 5 жыл бұрын
I always wait for ur video u are my favourite
@mobindiwan8972
@mobindiwan8972 2 жыл бұрын
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
@abdulrahimjalloh363
@abdulrahimjalloh363 7 ай бұрын
Thanks mam, you are the best teacher in the world for programming.
@-AshwithaAlladi
@-AshwithaAlladi Жыл бұрын
No one will beat Jenny's mam explanation in the world 🎉🎉🎉❤❤ wow 👏 great explanation
@ThabuRazz
@ThabuRazz Ай бұрын
The Best Teacher Ever in IT industry 💌
@tarunjindal3797
@tarunjindal3797 4 жыл бұрын
I m regretful why I didn't came here before ....best way to explain, thnku ma'am 🙌
@ntrahulkumar3784
@ntrahulkumar3784 5 жыл бұрын
One of the best way to explain these all
@rahulbelwal9577
@rahulbelwal9577 Жыл бұрын
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. गुरु ब्रह्मा गुरु विष्णु गुरु देवो महेश्वरा: गुरु साक्षात परम ब्रम्ह तस्मे श्री गुरवे नमः
@motogrip3268
@motogrip3268 4 жыл бұрын
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!
@RajKotecha-dc3yx
@RajKotecha-dc3yx Жыл бұрын
Tomorrow i have exam of data structure and i am just only watching your videos..i am perfectly learn and study your video that my 15+ experienced sir is not good explained as you..thank you so much😀 Before data structure was very difficult but at least now data structure is like and very interesting..thanks again!
@prasannasrinivasan
@prasannasrinivasan 4 жыл бұрын
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 KZbin. Thank you!
@radhikasanthosh8769
@radhikasanthosh8769 4 жыл бұрын
Mam, The effort you put makes your class wonderful.. will you please say whether this code is correct for deleting a node from a particular position. while(inext; i++; } prevnode->next=temp->next; free(temp);
@vijayXvirat
@vijayXvirat Жыл бұрын
Tomorrow is my lab external exam i don't even know what is inked list by watching your video iam able write a code on different operations on linked list thank you man thank you so much !!
@shreyabanik6986
@shreyabanik6986 3 жыл бұрын
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 😊
@immayatt
@immayatt 4 жыл бұрын
i have bought a course from codingblocks but still i learn from your channel. Firstly because aap bohot acha padhte hain. Second of all man laga rehta hai.
@kpandeeswari6037
@kpandeeswari6037 4 жыл бұрын
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
@FarhanAli-km5id
@FarhanAli-km5id 4 жыл бұрын
I have a problem to understand linked lists , suddenly search in you tube and I watched your only one video and I become fan of your methology. Thanks for serving us. Outstanding mam, best wishes from me. FARHAN...
@mdnavidrahmannavid2858
@mdnavidrahmannavid2858 Жыл бұрын
Best teacher ever love from Bangladesh.
@veercreation9111
@veercreation9111 5 жыл бұрын
Best way of explanation. I ❤️ the way. I have seen many teachers's video but no one can teach like this.
@farhanaziz1177
@farhanaziz1177 Жыл бұрын
Best Teacher 🌟
@ShivamKumar-pg4qz
@ShivamKumar-pg4qz 5 жыл бұрын
great explanation mam.......cutest teacher ever
@amanmehtafr7
@amanmehtafr7 5 жыл бұрын
Agreed
@sarab3427
@sarab3427 3 жыл бұрын
You are doing such a great work.I was confusing at every step but your explanation made me everything clear.Thankyou for your existence
@AM-xu6sd
@AM-xu6sd Жыл бұрын
Mam, when I saw data structure, I was think8ng why I took MCA course, but thanks a lot to save me.😌😌😌😌
@kalaivani4686
@kalaivani4686 4 жыл бұрын
Crystal clear explanation mam 💝💝 thanks a lot ...hats off to your hardwork ..👏👏✨💝😍
@udaytejareddypingili1889
@udaytejareddypingili1889 4 жыл бұрын
Unable to stop commenting this video excellent explaining keep it up thanks for the upload😍😍
@satyammishra2567
@satyammishra2567 2 ай бұрын
Very good explanation ma'am, very clear and simple techniques, thank you ma'am, thank you so much ❤
@rahulkumarsaw4959
@rahulkumarsaw4959 4 жыл бұрын
Mam really ur lecture is awesome... Thanku so🤗🤗 much to provide such a costly lecture at free....
@rahulkumarsaw4959
@rahulkumarsaw4959 4 жыл бұрын
I added all this DSA lecture in my college curriculum.. Task..
@mitanshi6893
@mitanshi6893 3 жыл бұрын
mam you are of of the best teacher , the way you explain , no one can thank you so much.
@sushanthraju3215
@sushanthraju3215 5 жыл бұрын
thank you so much for understanding in easier way. our teacher tells in a way that she only doesnt understand .
@cat-codes1on1
@cat-codes1on1 2 жыл бұрын
bro kaha placement hua
@sushanthraju3215
@sushanthraju3215 2 жыл бұрын
@@cat-codes1on1 how do u know that I got placed ??
@cat-codes1on1
@cat-codes1on1 2 жыл бұрын
@@sushanthraju3215 bro 2 yrs ago u commented on this video...so i guessed ki placement ho hi gya hoga...btw konsi company me hua
@MrinalDas3107
@MrinalDas3107 3 жыл бұрын
As usual your contents are superb. #JustRandom Love the way you say "Nowww"
@Viratian_King18
@Viratian_King18 3 жыл бұрын
From ur video I have learnt how to make a code by myself🔥.
@shreechatane9215
@shreechatane9215 4 жыл бұрын
Simplicity is elegance ~thank you ma'am
@manjitroy2054
@manjitroy2054 Жыл бұрын
very helpfull , only your explanation make complex form easy. thank you
@LocadiaShonhiwa-y6s
@LocadiaShonhiwa-y6s Жыл бұрын
Display light came in 5minutes as the video was playing well addressed thank you ma'am ❤
@sanjanahalli1174
@sanjanahalli1174 2 жыл бұрын
You are one of the best teacher mam! I request u to upload java coding also
@maheshdhanawade3716
@maheshdhanawade3716 4 жыл бұрын
Your teaching is very helpfuul for me.Your teaching is very nice ma'am.
@wdr2872
@wdr2872 3 жыл бұрын
Thanks madam. This is the best explanation I have ever hear. Thanks a lot...........
@purtidesai445
@purtidesai445 Жыл бұрын
Brilliantly explained. I just wonder how does the free() method work, rest everything explained in the video is super clear! Thank you so much!!
@Cloudnineninenine
@Cloudnineninenine 2 жыл бұрын
Clear explanation madam .... thank you so much 👌
@seknowforsid369
@seknowforsid369 Жыл бұрын
mam your videos helped me a lot in learning concepts of DSA .
@job_freak
@job_freak 4 жыл бұрын
You are so great finaally i cleared my concept in linked list
@SUDHANRCSE
@SUDHANRCSE Жыл бұрын
Its Very clear to understand.....❤❤❤
@-AshwithaAlladi
@-AshwithaAlladi 3 жыл бұрын
Tq so much mam because of u I am learning data structure easily and interestingly hatts off to you mam
@27zunairazulfiqarali98
@27zunairazulfiqarali98 4 жыл бұрын
JazakAllah bhut Acha smjahati hai
@Shivani-vg6lp
@Shivani-vg6lp 5 жыл бұрын
Thanks, you are teaching in very nice way.☺️
@vaibhavgupta777
@vaibhavgupta777 Ай бұрын
Thank You So So Much Mam🙏🙏🙏🙏
@maseeramaseera9720
@maseeramaseera9720 Жыл бұрын
Not me watching ur vedios instead of studying😂 thank u so much it cleared all my doubts, by the way my exams start after 3 days .. 😅
@shriramnirmal5535
@shriramnirmal5535 2 жыл бұрын
This is a very clear explanation, when ever I need a recall , I refer this content, great work mam
@villainplayz5435
@villainplayz5435 Жыл бұрын
Clarity -> You ❤️
@cherukurisagarteja151
@cherukurisagarteja151 3 жыл бұрын
I would like to say you are the best ........
@vamsiop1875
@vamsiop1875 3 жыл бұрын
Extra-ordinary explanation mam Very useful for exams
@nikhilteja8171
@nikhilteja8171 2 жыл бұрын
Thanks!...This video has helped me...
@CrazyGaming-to9pc
@CrazyGaming-to9pc 3 жыл бұрын
Ma'am your explanation is very very to me, thanks a lot
@justcurious1940
@justcurious1940 Жыл бұрын
// creating a linked list and deleting nodes from it full implementation // All rights reserved to Just Curious 😊 struct node { int data; struct node *next; }; struct node *head = NULL,*new_node,*last_node,*prev_node,*temp; // last node is to keep track of the last node so we can link it to a new node void create (){ new_node = malloc(sizeof(struct node)); printf("Enter the data for the node : "); scanf("%d",&new_node->data); new_node->next = NULL; if (head == NULL){ head = last_node = new_node; } else { last_node->next = new_node; last_node = new_node; } } void delete_from_beginning(){ temp = head; if(head != NULL) { head = head->next; free(temp); } } void delete_from_end(){ temp = head; prev_node = NULL; if(head != NULL){ while(temp->next!=NULL){ prev_node = temp; temp = temp->next; } } if(prev_node != NULL){ prev_node->next = NULL; } free(temp); } void delete_from_position(){ int pos; printf("Please enter the position : "); scanf("%d",&pos); if(pos == 1) { delete_from_beginning(); return; } int counter = 0; temp = head; while(temp != NULL){ ++counter; temp= temp->next; } if(pos counter){ printf("Error we can't delete this node !! "); return; } temp = head; prev_node = NULL; int i = 1; while(inext; ++i; } prev_node->next = temp->next; free(temp); } void display(){ temp = head; while(temp != NULL){ printf("%d\t",temp->data); temp = temp->next; } } int main () { int size; printf("Enter the size of the linked list to start with : "); scanf("%d",&size); for(int i = 0 ; i < size ; i++){ create(); } display(); printf(" "); int choice = true ; while(choice && head) { printf("Choose 1 of these operations to be done to the linked list : " \ "press 1 : to delete from the beginning. " \ "press 2 : to delete from the end. " \ "press 3 : to delete from a specific position. " \ "press 0 : to exit. "); scanf("%d",&choice); switch(choice){ case 1 : delete_from_beginning(), display() , printf(" "); break; case 2 : delete_from_end(), display() , printf(" "); break; case 3 : delete_from_position(), display() , printf(" "); break; default : printf("Good buy!! "); } } return 0; }
@AISHWARIAROYSNIGDHA
@AISHWARIAROYSNIGDHA 4 жыл бұрын
Very helpful video,thank you ma'am.
@amangupta9232
@amangupta9232 5 жыл бұрын
good video , you teaching very well.
@swapniljamble9063
@swapniljamble9063 2 жыл бұрын
In delete from any position temp=head;i=1; then condition is while(i
@jayakrishnakalluri1375
@jayakrishnakalluri1375 2 жыл бұрын
Mam you so Buetifull ❤❤❤❤🤩
@Shabdislive
@Shabdislive 4 жыл бұрын
Your teachings are great mam ! I guess we can also do it with just, head and temp, the del from last one by changing a lil bit fron the function created if we assume that we haven't deleted the first node ... 🙂
@aakashvishwakarma4653
@aakashvishwakarma4653 5 жыл бұрын
Thank you ma'am for your support
@tejashwinisajjan7223
@tejashwinisajjan7223 10 ай бұрын
What amazing lecture❤️
@LoveIsLifeTurkishIndia
@LoveIsLifeTurkishIndia 4 жыл бұрын
We can use for loop for deletion from end and also calculate length of linked list . And then loop it till n-1 and we can empty it
@FarhanAli-km5id
@FarhanAli-km5id 4 жыл бұрын
Amazing mam..👏👏
@KhushbooKumari-iy2to
@KhushbooKumari-iy2to 4 жыл бұрын
Thanks a lot mam......😊 well explained......
@GaneshGowda-y1y
@GaneshGowda-y1y 2 ай бұрын
i tried deleting the element from middle of the list and here is the code, it's slightly different from your method but the base is same void del_at_mid(struct node** head){ struct node *temp, *PrevNode; int i = 1, loc; printf("Enter the element which you want to delete: "); scanf("%d", &loc); temp = *head; while(inext; i++; } if(temp == *head){ head = 0; } else{ PrevNode->next = temp->next; } free(temp); display(*head); }
@-AshwithaAlladi
@-AshwithaAlladi 3 жыл бұрын
Mam ur way of explanation is awesome and also please upload the video how to search and display in linked list once I am thanking u from my bottom of my heart
@kk_arts_atp1133
@kk_arts_atp1133 3 жыл бұрын
I love u r teaching
@ramankumar41
@ramankumar41 3 жыл бұрын
Thank You Ma'am, very clear explanation !!!
@Tbm4545
@Tbm4545 Жыл бұрын
Hey deletion from given position can also be done in different way Same like deleting at the end..... If we have given delete a given node from list inplce of position than. We can traverse it. Than when the data is equal to given data. We can store Temp of next on a new pointer say nxt. And we can save the previous pointer on pre. Than We can simply say pre of next = nxt of next 👍👍👍👍 Just we required a extra pointer here i.e 3 rd pointer
@hiteshparasa
@hiteshparasa 5 жыл бұрын
i love ur class
@vaishnavidongare4408
@vaishnavidongare4408 4 жыл бұрын
Best explanation!!☺️
@efthakharbin5803
@efthakharbin5803 2 жыл бұрын
Thanks a lot mam , your explanations are awesome.
@sarahcraft5399
@sarahcraft5399 2 жыл бұрын
Very well explained hats off to you
@balkishan9800
@balkishan9800 4 жыл бұрын
I also shocked when u said "happy independence day" because I am watching it on 15 Aug.
@pruthvijagadeesh5158
@pruthvijagadeesh5158 5 жыл бұрын
Wow nice explanation for c programming Can u give explanation for c++? And i must say one best beautiful youtuber
@vairamdhanush5594
@vairamdhanush5594 3 жыл бұрын
explanation and logic implementation excellent mam
@Hemashree_Gunasekaran_25
@Hemashree_Gunasekaran_25 7 ай бұрын
15:50 delete at end
@NagarajuGampa-nc3wd
@NagarajuGampa-nc3wd 5 ай бұрын
In your explanation use telugu also. Yours explanation is very super
@ananthunandhu6980
@ananthunandhu6980 4 жыл бұрын
Very helpfull great work Mam
@Manan_91
@Manan_91 9 ай бұрын
Excellent 👌
@CrazyGaming-to9pc
@CrazyGaming-to9pc 3 жыл бұрын
*very useful and informative to me
@VishalYadav-ss4qv
@VishalYadav-ss4qv 4 жыл бұрын
Excellent teacher you're mam ❤️❤️❤️🙏
@samChakravartiSamrat
@samChakravartiSamrat 4 жыл бұрын
I luv u ma'm.....for your data structures videos!!!
@mansisen2225
@mansisen2225 Жыл бұрын
Happy independence ma'am ❤
@muhammedsaidatabay7547
@muhammedsaidatabay7547 4 жыл бұрын
I couldn't had passed the exam, after the video I will pass insallah. Thank you so much...
@vinethasuresh3488
@vinethasuresh3488 Жыл бұрын
Thanks a lot mam, It really helps.
@krithikkumar959
@krithikkumar959 4 жыл бұрын
Please try to enable playback speed option for your video. It will be very helpful.
@swatantrapatel7608
@swatantrapatel7608 3 жыл бұрын
congrats for 500k
2.7 Find length of Linked List- Iterative approach | DSA Tutorials
5:56
Jenny's Lectures CS IT
Рет қаралды 209 М.
2.8 Reverse a Linked List - Iterative Method | Data Structure Tutorials
18:44
Jenny's Lectures CS IT
Рет қаралды 445 М.
Wednesday VS Enid: Who is The Best Mommy? #shorts
0:14
Troom Oki Toki
Рет қаралды 50 МЛН
2.4 Linked List Implementation in C/C++ | Creation and Display | DSA Tutorials
29:01
Jenny's Lectures CS IT
Рет қаралды 1,8 МЛН
LINKED LIST (DELETION FROM BEGINNING,ENDING AND SPECIFIED POSITION) - DATA STRUCTURES
21:32
3.1 Stack in Data Structure | Introduction to Stack | Data Structures Tutorials
17:40
2.9 Introduction to Doubly Linked List in Data structures | DSA Tutorials
8:54
Jenny's Lectures CS IT
Рет қаралды 385 М.
4.1 Queue in Data Structure | Introduction to Queue | Data Structures Tutorials
20:19
LINKED LIST (INSERTION AT BEGINNING,ENDING,SPECIFIED POSITION ) - DATA STRUCTURES
23:17
2.1 Introduction to Linked List | Need of Linked List | DSA Tutorials
22:11
Jenny's Lectures CS IT
Рет қаралды 1,3 МЛН