2.12 Deletion from Doubly Linked List (beginning,end,specific position) | Data Structures Tutorials

  Рет қаралды 249,033

Jenny's Lectures CS IT

Jenny's Lectures CS IT

Күн бұрын

Пікірлер: 176
@mdnazisharman0187
@mdnazisharman0187 4 жыл бұрын
i was about to give up on data structures... thank you mam for your superb detailed explanation videos which boosts up motivation and made my interest to learn more and more... now i get why these lectures are free, because no one else could afford to buy these priceless lecture.. thanks a lot mam...
@godhaninisarg1570
@godhaninisarg1570 11 ай бұрын
same bro muje samaj hi nhi aa raha tha college me isliye maine soch liya tha DS mere liye nhi hai me kabhi nhi sikh paunga par ma'am ne bacha liya
@JennyslecturesCSIT
@JennyslecturesCSIT 5 жыл бұрын
CORRECTION: 1) in both delfrombeg() and delfromend() , we will write one more "if condition" to check if there is only one node in the list: if(head==tail) { head=tail=0; free(temp); } 2) in delfrompos() function , we will check for corner cases: if(pos==1) { delfrombeg(); } in else part after while loop we will check whether the node you want to delete is last node or not by writing: if(temp->next==0) { tail=tail->prev; tail->next=0; free(temp); }
@nigampratap2466
@nigampratap2466 4 жыл бұрын
Mam I think we should also have a condition like suppose we want to delete from position number 'm' then we should check from which end it is nearer (from head or tail) accordingly we will traverse from forward or backward. In test cases with large number of nodes this might be become handy
@hardikmittal7291
@hardikmittal7291 4 жыл бұрын
I was just going to ask you the same thing in comments... 😂😂
@user-kb9tz7pp9y
@user-kb9tz7pp9y 3 жыл бұрын
@@nigampratap2466 wat do u think about using lenght of striing and tail for this case ????
@karrran
@karrran 3 жыл бұрын
in the delfrompos(), after checking the node is last or not.. can we call delfromend() in the if?
@kirtikhohal5025
@kirtikhohal5025 2 жыл бұрын
@@karrran yes we can call delfromend function
@Kishorthakre_
@Kishorthakre_ 4 жыл бұрын
After watching your DS videos, I easily implemented it with Python. It's helped me a lot. Thanks Ma'am 👍
@smiletripathi3839
@smiletripathi3839 2 жыл бұрын
You explain each and every step in detail.It helps alot to solve the confusion.Thanks a lot for your hardwork.
@hamidullah3641
@hamidullah3641 5 жыл бұрын
You are doing so great.... may Allah bless u always
@likhithshivaji5173
@likhithshivaji5173 3 жыл бұрын
Alla Nimmavan shatad tulla
@ankitakundu4278
@ankitakundu4278 5 жыл бұрын
Thanks a lot maam. Now I can code singly & doubly linked list by my own. I am getting this confidence only because of you ma'am. Maam i have a request, i watched your all sorting algorithm videos, in heap sort you described us only max heap using examples..so I want if you kindly make a video on min heap too..
@JennyslecturesCSIT
@JennyslecturesCSIT 5 жыл бұрын
sure.. will upload soon
@sunnykumar-dg7gs
@sunnykumar-dg7gs 5 жыл бұрын
Maam u are not allowed to explain so good😅.. This video just cleared all my previous doubts🙂🙂
@RamKumar-bx1lz
@RamKumar-bx1lz Жыл бұрын
Cringe
@Jo-bf2hf
@Jo-bf2hf Жыл бұрын
fr cringe af
@over_kill
@over_kill Ай бұрын
@@sunnykumar-dg7gs naughty horrrha
@mujtabasiddiqui
@mujtabasiddiqui 2 жыл бұрын
Great Efforts really appreciated thanks a lot first time after 15 years I am touching code and after the video I am able to write the code thanks a lot
@lokeswaripanchireddi-z6l
@lokeswaripanchireddi-z6l 8 ай бұрын
Mam after listening your DSA videos,I got interest on learning CSE Thank u very much mam😊
@akshathole6641
@akshathole6641 2 жыл бұрын
Mam we need more lectures from this tutorial. The way you have taken values for previous and next make it more easier for us to understand.
@AbhinavKumar-dr4ef
@AbhinavKumar-dr4ef 2 жыл бұрын
Salute to you for a clear explanation. God bless you for your hard work Mam.
@CodingWorld202
@CodingWorld202 2 ай бұрын
Mam...U are Just Fire..like what the level of teaching
@AZ-gm9ol
@AZ-gm9ol Жыл бұрын
The best explanation which I’ve ever heard. Thanks
@madhurin5587
@madhurin5587 4 жыл бұрын
All the concepts are explained beautifully! Would you create a " OOPS in Java " complete series too?
@rahulmuthavarapu4793
@rahulmuthavarapu4793 5 жыл бұрын
\\alternate method delfromend() : temp=tail; tail=temp->prev; tail->next=0; temp->prev=0; \\or (free(temp));
@LoveIsLifeTurkishIndia
@LoveIsLifeTurkishIndia 4 жыл бұрын
No need for 4th statement
@priyankabharti9150
@priyankabharti9150 4 жыл бұрын
Maam ...your explaining technique is owsm ....👌 And becoz of you only i clear my concept in all the topics in data structure ... 😊🤗 ..and we are very glad that we have teacher like you ... Keep it maam god bless you ..🤗
@vaibhavacharya7507
@vaibhavacharya7507 5 жыл бұрын
Hello mam!!! You are teaching soo soo soo good... I request you to mam for create a video playlist for JAVA and computer architecture..... And mam u Forgot To create forward videos of operating system so please mam work on it... I hope u will create in soon ... Thank u mam...
@vaibhavnigam6497
@vaibhavnigam6497 4 жыл бұрын
Ma'am your explanation technic is mind blowing that is very suitable for anyone new to learn.... your idea of imparting knowledge through such type of tutorials is admirable. you are one of teacher who is teaching with clearing concept as well as genuine n deep points... These r helping me a lot. Thanq so much.
@YashSingh-wv3yx
@YashSingh-wv3yx 3 жыл бұрын
You are the best teacher and your videos are very knowledgeable!!!👍
@akbarahmad5245
@akbarahmad5245 5 жыл бұрын
No doubt, there are some other teachers who are teaching Data Structure but mam the attribute which separates you from them is that you also teach us coding in Data Structure. Thankyou so much mam ;) Mam, can you please tell me how to prepare DS, DB, OS, CCNA mcq’s? Any reference mam.
@medusagaming7001
@medusagaming7001 3 жыл бұрын
Thank you very much maam for the dedication in teaching complex topic for students and uploading videos for free. God Bless you!!
@aparnadubey1134
@aparnadubey1134 5 жыл бұрын
Thanks for teach us ds in easy English language.. Thanks a lot mam.. Help us always
@Yaki-qn3yx
@Yaki-qn3yx 3 жыл бұрын
best *lecture -> Jenny's lectures CS/IT NET&JRF
@badvelisridharreddy1677
@badvelisridharreddy1677 2 жыл бұрын
Mam your way of explaining and method of explaining concepts is really awesome and next level 👏👏👏 Very much thanks ro you mam for making these amazing videos for students like us....
@edwintjoa6099
@edwintjoa6099 4 жыл бұрын
Thank you for a clear explanation on how the doubly linked list works!!
@006daredevil
@006daredevil 2 жыл бұрын
Very Important we should write temp==Null; after free(temp) or else temp pointer will be a Dangling pointer.
@holyshit922
@holyshit922 5 жыл бұрын
Maybe split linked list (after given node , before given node) and concatenation of linked list It will be useful for divide and conquer algorithms
@gayatriborade9556
@gayatriborade9556 2 жыл бұрын
Because of you ma'am I am able to clear all my doubts of linked list and now I can code very confidently...Thank you so much ma'am
@rashid7197
@rashid7197 3 жыл бұрын
Understanding DATA STRUCTURES AND ALGORITHMS is difficult but don't worry We have Jenny mam . she made this as easy to understand
@PabloEscobar-vm5oy
@PabloEscobar-vm5oy 9 ай бұрын
thanks for your superb lectures and also i thanks god for superb bueaty
@creativemarvel4569
@creativemarvel4569 4 жыл бұрын
Most helpful video for me and my friends as well. Thankyou mam
@ashwinipowar2230
@ashwinipowar2230 4 жыл бұрын
Mam you are teaching very good.please create playlist for C Programming lectures so that it will clear basics.
@hamidullah3641
@hamidullah3641 5 жыл бұрын
Ma'am you are so great
@priyankababar3566
@priyankababar3566 3 жыл бұрын
Thank you so much. U make understand the concept very clearly
@khushbu6424
@khushbu6424 2 жыл бұрын
You explain so nicely :)
@dnazehar7969
@dnazehar7969 Жыл бұрын
MAM Please e a dekhna thoda sa alag hai #include struct node { int data; struct node *next; struct node *prev; }; struct node *head,*temp,*newnode; int count=0; int main() { int choice; while(1){ printf("Enter choice : 1.Creat.\t2.insert at start.\t3.Insert at end.\t4.Insert at after location.\t5.Display.\t6.Exit "); scanf("%d",&choice); switch(choice) { case 1: creat(); break; case 2: insertstart(); break; case 3: insertend(); break; case 4: insertloc(); break; case 5: display(); break; case 6: exit(0); break; default: printf("wrong choice"); break; } } } void creat() { newnode = (struct node*) malloc(sizeof(struct node)); printf("Enter data : "); scanf("%d",&newnode->data); newnode->prev = 0; newnode->next = 0; if(head==0){ head = temp = newnode; newnode->prev = 0; newnode->next = 0; count++; } else{ temp->next = newnode; newnode->prev = temp; newnode->next = 0; temp = newnode; count++; } } void insertstart() { newnode = (struct node*) malloc(sizeof(struct node)); printf("Enter data : "); scanf("%d",&newnode->data); newnode->prev = 0; newnode->next = 0; if(head==0){ head = temp = newnode; } else{ head->prev = newnode; newnode->next = head; newnode->prev = 0; head = newnode; } } void insertend() { temp = head; newnode = (struct node*) malloc(sizeof(struct node)); printf("Enter data : "); scanf("%d",&newnode->data); newnode->prev = 0; newnode->next = 0; if(head==0){ head = temp = newnode; } else{ while(temp->next!=0){ temp = temp->next; } temp->next = newnode; newnode->prev = temp; } } void insertloc() { int i=1,pos; temp = head; printf("Enter position :"); scanf("%d",&pos); if(pos==1){ insertstart(); } else if(pos>count){ printf("Invalid position!"); } else{ newnode = (struct node*) malloc(sizeof(struct node)); printf("Enter data : "); scanf("%d",&newnode->data); newnode->prev = 0; newnode->next = 0; while(inext; i++; } newnode->prev = temp; newnode->next = temp->next; temp->next = newnode; temp->next->prev = newnode; } } void display() { temp = head; while(temp!=0){ printf("%d ",temp->data); temp = temp->next; } }
@susheelkumar7029
@susheelkumar7029 5 жыл бұрын
Thank you for this well explained video
@holyshit922
@holyshit922 5 жыл бұрын
In function delfrombeg() Suppose we have only one node on the list you did not update tail pointer We can have dereferencing of null pointer in head->prev = 0; In function delfromend() Suppose we have only one node on the list you did not update head pointer In function delfrompos() check your edge cases
@JennyslecturesCSIT
@JennyslecturesCSIT 5 жыл бұрын
noted.. and I have written the corrections too.. :)
@GraphicalBoss
@GraphicalBoss 4 жыл бұрын
Great job! Thank you and God bless 🙏 🕊✝️
@AISHWARIAROYSNIGDHA
@AISHWARIAROYSNIGDHA 4 жыл бұрын
Very helpful video,thank you ma'am.
@abhiram6087
@abhiram6087 4 жыл бұрын
Your content and explanation is excellent, but it would be great if you guys try to reduce the length of the vedio
@sasikirankakara3773
@sasikirankakara3773 5 жыл бұрын
Nice Teaching Mam!
@gargaarohi
@gargaarohi 4 жыл бұрын
Thank You ma'am for this lecture
@ferreira0717
@ferreira0717 4 жыл бұрын
Me gusta como explicas ! Saludos desde colombia.
@nithinreddyannem4535
@nithinreddyannem4535 3 жыл бұрын
Sus....
@kanavghai887
@kanavghai887 5 жыл бұрын
inspirational stuff!
@shubhamgurav9194
@shubhamgurav9194 2 жыл бұрын
Thanks a lot ma'am 🔥🔥💯💯👍
@shivaryanbral
@shivaryanbral 2 жыл бұрын
we can simply free(temp) without using temp->prev=0, because the node will automatically deleted once we use free function to clear the node ..(If I'm not wrong) I've tried this
@muhammadaiman2674
@muhammadaiman2674 4 жыл бұрын
thankyou maam, this is very helpful
@arshadazath5080
@arshadazath5080 Жыл бұрын
Thank you so much ma'am
@snehamareddy1867
@snehamareddy1867 4 жыл бұрын
Simply super mam
@patnamvivek2406
@patnamvivek2406 3 жыл бұрын
Really thank you so mucn madam
@Praxss
@Praxss 4 жыл бұрын
Nicely explained 👍🏻
@Vister7713
@Vister7713 4 жыл бұрын
Explain the procedure of inserting an element after the specified position of the doubly linked list and also write the program for that operation.
@__Kuch_Bhi___
@__Kuch_Bhi___ 6 ай бұрын
👍🙂 very nice video
@dhanalaxmi5066
@dhanalaxmi5066 2 жыл бұрын
Tnq so much mam
@dr.tanishmandhan3882
@dr.tanishmandhan3882 Ай бұрын
❤thank u mam from deep of my heart, ur like a goddess
@somilsaxenamusicworld8053
@somilsaxenamusicworld8053 4 жыл бұрын
My favourite mam I request to cover linked list all questions especially which is on geeks for geeks and if u want put this is in paid promotion of ur rs 59 but plz post it
@gamingwithpj8572
@gamingwithpj8572 4 жыл бұрын
ty mam programs made so easy 💕💕
@holyshit922
@holyshit922 5 жыл бұрын
Deletion would be easier with search function (Delete node with given key value)
@shabbarrizvi6494
@shabbarrizvi6494 3 жыл бұрын
what a explanation
@yourstudy_guide.
@yourstudy_guide. 2 жыл бұрын
Thank you sooo much mam ❤️
@Rahul.r.r_p
@Rahul.r.r_p 11 ай бұрын
Day 16 completed
@kunalgajare4011
@kunalgajare4011 3 жыл бұрын
very helpful
@marimuthu_a
@marimuthu_a 3 жыл бұрын
Hello madam At 16:29 , while(I
@poojachitalkar9245
@poojachitalkar9245 4 жыл бұрын
Thank you so much mam 😘😘
@akashshah8866
@akashshah8866 Жыл бұрын
Please make a video on merge sort
@hometvfirestick
@hometvfirestick 3 жыл бұрын
thanks
@jaimeguerrero4677
@jaimeguerrero4677 4 жыл бұрын
you are amazing teacher thank you it helped me a lot
@susheelkumar7029
@susheelkumar7029 5 жыл бұрын
M'm please, make video on stack &queue,
@varanasiyaswanthshiva3538
@varanasiyaswanthshiva3538 5 ай бұрын
Mam why not "while (i
@codehypee
@codehypee Жыл бұрын
//deletion in doubly linked list #include #include struct node{ int data; struct node *prev,*next; }; struct node *head=NULL,*temp,*tail,*newnode; // display function void display() { temp = head; while (temp != NULL) { printf(" %d\t ", temp->data); temp = temp->next; } } // deletion from beg; void delbeg(){ if(head == tail){ head=tail=0; free(temp); } else{ temp=head; head = head -> next; head -> prev = 0; free(temp); } printf("Updated doubly ll: "); display(); } void delend(){ if(head == tail){ head=tail=0; free(temp); } else{ temp=tail; tail = tail -> prev; tail -> next = 0; free(temp); } printf("Updated doubly ll: "); display(); } int getlength(){ int length=0; temp=head; while(temp!=NULL){ temp=temp->next; length++; } return length; } void delatpos(){ int pos,i=1; int len=getlength(); printf("Enter position: "); scanf("%d",&pos); if(pos>len || posprev->next = temp->next; temp->next->prev = temp -> prev; free(temp); printf("Updated doubly ll: "); display(); } } int main(){ int choice = 1; while(choice){ newnode = (struct node*)malloc(sizeof(struct node)); printf("Enter data: "); scanf("%d",&newnode->data); newnode->next = NULL; newnode->prev = NULL; if(head == NULL){ head=tail=newnode; } else{ tail->next=newnode; newnode->prev=tail; tail=newnode; } printf("Do you want to continue press 1 otherwise 0: "); scanf("%d",&choice); } printf("Values of Doubly ll: "); display(); printf(" Press 1 to delete a node in the beginning, 2 to delete a node at the end, and 3 to delete a node at a given position: "); scanf(" %d",&choice); switch (choice){ case 1: delbeg(); break; case 2: delend(); break; case 3: delatpos(); break; default: printf("Input not valid."); } return 0; }
@shree_275
@shree_275 Жыл бұрын
Run ho raha hai kya?
@codehypee
@codehypee Жыл бұрын
@@shree_275 hmm
@nikeshparajuli6345
@nikeshparajuli6345 4 жыл бұрын
thanks a lot maam .
@techyink5344
@techyink5344 Жыл бұрын
ty ma'am
@nickname240
@nickname240 4 жыл бұрын
Super.....
@kalam_kadipina_manasu
@kalam_kadipina_manasu Ай бұрын
temp=head; while(temp->next!=0) { temp=temp->next; } temp->prev->next=0; free(temp) ; Ma'am this code is correct or not for Deleting a node at end of the list in Doubly linked list
@continnum_radhe-radhe
@continnum_radhe-radhe 2 жыл бұрын
🔥🔥🔥
@naimeimran3247
@naimeimran3247 2 жыл бұрын
Thanks mam
@varuniiit4743
@varuniiit4743 Жыл бұрын
Guys without using temp, I think we can free memory of nodes using head or tail pointers themselves right?? in case of deletion at begin and end.
@be_like_gentelman9098
@be_like_gentelman9098 Жыл бұрын
deletion @ end // its else condition statement else { tail -> prev=temp; temp ->next=NULL; free(tail); tail=temp; } it's possible
@sarthakjoshi21
@sarthakjoshi21 3 жыл бұрын
mam pls show full coderunning in editor so that i know where i did mistake
@taufiquepathan2303
@taufiquepathan2303 3 жыл бұрын
Mam really I appreciate your knowledge you are so good mam.Mam I copy your code but in doubly linked list deletefromend function is not true I am getting error
@abhimanyugaur1046
@abhimanyugaur1046 2 жыл бұрын
for deletion at beginning is this logic correct? temp=head head-=head->next head->previous = null free(temp)
@kriti4698
@kriti4698 2 жыл бұрын
yes it seems like
@harshilpatel3205
@harshilpatel3205 Жыл бұрын
Yes it's almost correct but you have to write one more condition for temp(1st node which you have to delete) because temp->next part has the value of head(2nd node after update) so you have to null that part too. Condition is : temp->next=0; Now you can free that temp node ... Free(temp)..
@gaurav.89
@gaurav.89 4 жыл бұрын
Mam pleasee explain tail pointer in del from end. How it is storing, how we are accessing it. Please Explain
@ramitbhattacharjee7485
@ramitbhattacharjee7485 3 жыл бұрын
Mam we have to set temp->next=0.. Otherwise temp will connected with the next node as a singly linked list.. Ri8??
@shahzaibanwar4570
@shahzaibanwar4570 5 жыл бұрын
Mam Your method is As Cute As you.
@msdhoni7816
@msdhoni7816 3 жыл бұрын
Ur beautiful ❤️ Ur explaining also
@amantyagi6057
@amantyagi6057 4 жыл бұрын
Before deallocate or free the required node should we store the data of this node or not.
@vinaypratap620
@vinaypratap620 3 жыл бұрын
Mam this code will work when only one node in the list ???
@samadritamukherjee6198
@samadritamukherjee6198 3 жыл бұрын
can you do deletion from before and after a node i am having problem doing those
@sofialegpitansegura1251
@sofialegpitansegura1251 5 жыл бұрын
Saying last word "fine"😂
@arunabhachatterjee9979
@arunabhachatterjee9979 Жыл бұрын
mam from this code the last node is not deleted
@mdshahnawaz645
@mdshahnawaz645 3 жыл бұрын
👍👍
@huycao8521
@huycao8521 4 жыл бұрын
Hello Mrs ! Can I use delete in stead of free if I am using C++ ? Thank you very much
@PRANESHJANA
@PRANESHJANA 2 ай бұрын
If I insert 8 elements ,and if I delete the 8th element I'm losing the last 2 elements or my program gets stopped,please clarify my doubt and reply asap Mam 🙏
@AnushaYadav01
@AnushaYadav01 4 жыл бұрын
Can we write in this way for deleting a node in the end Logic part While (temp->next!=NULL) { temp=temp->next; temp->prev->next=NULL; }
@houba1263
@houba1263 4 жыл бұрын
how can we simplfy temp->prev->next plz can i write in a different way?
@nitalisondkar6321
@nitalisondkar6321 4 жыл бұрын
Yes.....I was also thinking of that only becz this is easy as compare to that
@xxsebaignacioxxgomez5019
@xxsebaignacioxxgomez5019 3 жыл бұрын
question how can you delete a node from its data? in my case, I need to set data as an artists and ask the user to input an artist name, if that name coincides with any data or value of the node, delete it . Thank you so much!
@arunvijay2279
@arunvijay2279 4 жыл бұрын
can i do this is using only temp pointer alone mam?
@a.c.m.education6768
@a.c.m.education6768 3 жыл бұрын
Mam, I wrote this code and it showed segmentation fault:11 What should I do now?
@heman6570
@heman6570 Жыл бұрын
Is it mandatory to free any node after unlinking
2.13 Reverse a Doubly Linked List | Data Structures & Algorithm Tutorials
19:34
Jenny's Lectures CS IT
Рет қаралды 172 М.
Doubly Linked List (Insertion between the Nodes) - Part 1
6:19
Neso Academy
Рет қаралды 127 М.
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 17 МЛН
كم بصير عمركم عام ٢٠٢٥😍 #shorts #hasanandnour
00:27
hasan and nour shorts
Рет қаралды 11 МЛН
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 2,6 МЛН
This Game Is Wild...
00:19
MrBeast
Рет қаралды 186 МЛН
Why is Python 150X slower than C?
10:45
Mehul - Codedamn
Рет қаралды 18 М.
⚡️NEWS | RUBLE COLLAPSE | STRIKE ON CRIMEA | PUTIN IN KAZAKHSTAN
10:34
Ходорковский LIVE
Рет қаралды 197 М.
2.15 Implementation of Circular linked list in C | Data Structure Tutorials
27:49
Jenny's Lectures CS IT
Рет қаралды 182 М.
2.14 Circular Linked List in Data Structure | Creation and Display | DSA Course
21:30
2.8 Reverse a Linked List - Iterative Method | Data Structure Tutorials
18:44
Jenny's Lectures CS IT
Рет қаралды 437 М.
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 17 МЛН