Complete C++ Placement Course (Data Structures+Algorithm) : • C++ Full Course | C++... Telegram: t.me/apnikaksh... Instagram: / dhattarwalaman Notes of this Lecture:
Пікірлер: 201
@raohammadraza2 ай бұрын
DIDI, I have been studying in this field for the last two years. I have watched many channels on KZbin in Hindi and Urdu, but this is the best of all, your channel.
@Newone-io6og7 ай бұрын
Thank you so much for making me realize that I dont understand it. I will sharp my focus. One thing I have noticed, that you have brilliant audience, the learner who understands everything in first iteration.
@kumarivandana15543 жыл бұрын
Considering some edge cases like: if the target is not present in the linked list or if the target is head but we don't have knowledge of this thing.. #include using namespace std; class node{ public: int data; node* next; node(int val) { data=val; next=NULL; } }; void insertAtHead(node* &head,int val) { node* n=new node(val); n->next=head; head=n; } void insertAtTail(node* &head,int val) { node* n = new node(val); if(!head) { head=n; return; } node* temp=head; while(temp->next) temp = temp->next; temp->next=n; } void display(node* head) { node* temp=head; while(temp) { coutnext) { coutnext; delete todelete; } int main() { node* head=NULL; insertAtTail(head,1); insertAtTail(head,2); insertAtTail(head,3); insertAtTail(head,4); insertAtTail(head,5); display(head); deletion(head,0); display(head); deletion(head,1); display(head); return 0; }
@savitosh913611 ай бұрын
works but it will lead to rise in space complexity more than required?
@harshvardhansingh7803 жыл бұрын
Dsa course of this playlist is not for the beginner .......but great work by whole team👍
@rahul_ji213 жыл бұрын
Bhai dsa is just like language starting me kuch samaj nhi ata but baad me ho jata he
@sawanpatel34913 жыл бұрын
bhai me beginner hi hu sb samjh me aa rha h
@lovelydreams56102 жыл бұрын
Each concept used is described previously in playlist soo.. It is absolutely for beginners
@RoHit-ct7lr2 жыл бұрын
Me beginner hi hu, ek baar me nahi samajh aata baar baar dekho
@pakeuropemedia6250 Жыл бұрын
Exactly
@danishfareed78582 жыл бұрын
A very advanced lecture is not completely comprehensible to beginners. My suggestion is that beginners should learn these concepts first in college and then take this tutorial.
@justarandomguy136328 күн бұрын
Just jumped here to check the actual code teaching and yeah it seems solid. I could understand a little bit of the deletion part just following the logic even though I am a newbie. Ok jumping back to the beginner course I was in 😂
@mrprincekumarsingh2253 Жыл бұрын
Thank you for your guidance and support, esteemed teacher.
@anshumansinghsomvanshi47503 жыл бұрын
One another condition is not checked.. When the searching element is not present in LInked List then the loop is executing infinite times Missing condition : In while loop after temp->temp->next if(temp==NULL){ cout
@karmanyadadhich61723 жыл бұрын
Right observation, but the correct code will be: if(temp->next == NULL){ cout
@shadowmonarch31552 жыл бұрын
@@karmanyadadhich6172 both are correct taking in account temp and next both are pointer...it is just that upper code loop will run 1 more times than yours
@shabankhan43833 жыл бұрын
Finally i understand 😃😃😃, after this video, I’m creating , inserting at any position in linked list , deleting from any position, by my self. I can’t explain how much I’m feeling happy 😊, I love this course , thank you again the teacher and Aman Bhaiya ♥️🥺
@siddharthabhunia78972 жыл бұрын
InClude Deletion Operation #include #include using namespace std; // Create A class node class node{ public: int data; node* next; // Node Class Constructor node(int val){ data=val; next=NULL; } }; // Insert Element At Tail void insertAtTail(node* &head,int val){ node* n=new node(val); if(head==NULL){ head=n; return; } node* temp=head; while(temp->next!=NULL){ temp=temp->next; } temp->next=n; } // Deletion, Delete A particular Element //Corner Case When want to delete firts node void deleteAtHead(node* &head){ node* todelete=head; head=head->next; // Avoid Memory Leak delete todelete; } void deletion(node* &head,int val){ //For No Node present if(head==NULL){ return; } //For present only one node if(head->next==NULL){ deleteAtHead(head); return; } node* temp=head; while(temp->next->data!=val){ temp=temp->next; } node* todelete=temp->next; temp->next=temp->next->next; delete todelete; //Avoid Memory Leak } // Display All Element void display(node* head){ node* temp=head; while(temp!=NULL){ cout
@suryajoshi89472 жыл бұрын
thank you bro😇😇😇😇
@itzsam6113 Жыл бұрын
Thank you bhai
@rahulsaw88383 жыл бұрын
One more corner cases will be there if val is not present then.. So what we can do is we can call the ispresent function to check whether val is present and then call delete node function Else Print_lists
@kartheeksilpi5075 Жыл бұрын
void headdelete(node* &head){ if (!head) return; node* dele=head; head=head->next; delete (dele); } void delet(node* &head,int val){ if(!head) return ; //if head is null then there are no nodes to be deleted node* temp=head; if(temp->data==val){ headdelete(head); // deleting first node of linked list and returning it back. return; } while(temp->next != NULL && temp->next->data!=val){ temp=temp->next; }if(temp->next==NULL){ // if the deleted element is not presented return ; } node* del=temp->next; temp->next=temp->next->next; delete del; }
@schoolyourself8773 жыл бұрын
Grt work Aman
@VishalKumar-zb8nc4 жыл бұрын
very nicely explained and take every variety of question in linked list
@deepakmodi93432 жыл бұрын
//More accurate code according to me void deleteAtHead(node *&head) { node *todelete = head; head = head->next; delete todelete; } void deleteNode(node *&head, int val) { if (head == NULL) { return; } node *temp = head; if (head->data == val) { deleteAtHead(head); return; } while (temp->next->data != val) { temp = temp->next; if (temp->next == NULL) { cout next = temp->next->next; delete todelete; }
@kapishsingh45293 жыл бұрын
One condition is not checked: if head->data==val; if(head->data==val){ deleteHead(head); return; }
@ranjitkoragoankar3 жыл бұрын
bro that is the same condition as deleteAtHead();
@kapishsingh45293 жыл бұрын
@@ranjitkoragoankar this is not covered if you call delete directly and val is your head :)
@vrajeshmodi49283 жыл бұрын
@@kapishsingh4529 The mid condition in deletion function which is "if(temp->next==NULL) { deleteAtHead(head) return;}" which is the same as you make for 1 element in Linked list.
@gajeet67453 жыл бұрын
@@vrajeshmodi4928 No, @KAPISH SINGH is right!, try having more than one node, and then try to delete the node which happens to be the first node by passing the "head and val" to deletion() in which val happens to be the data of the first node. For example: Let's say the list is 100, 200, 300. and you call the function deletion(head, 100); Here comes the issue as the node containing data=100 is the first node (head node); The mid condition only check if head is the only node instead it should be if(head->next == NULL || head->data == val){ deleteAtHead(); return; }
I think U r best in the world di. Plz take some important placement questions too di and make playlists of those.
@pradhanan94134 жыл бұрын
Which year are you in?
@sourabhchoudhary72894 жыл бұрын
These Videos are great no doubts!! But for Linked List I recommend to check Playlist of Simple Snippets . Love for Apni Kaksha Team😍
@maninax6615 Жыл бұрын
Thanks a lot mam 🖤
@prasaddalwee75333 жыл бұрын
Here is the error free code to delete nodes of linked list by their values. Note: 1. createlist() creates a linked list of size n dynamically 2. Open in your editor to see the code and comments properly #include using namespace std; class Node { public: int data; Node* next; }; Node* createlist(int n) { Node* head=new Node(); head->data=1; Node* node=head; for(int i=1;inext=node2; node2->data=i+1; node=node2; } Node* end=new Node(); //marks the end of LL with a NULL node node->next=end; end->data=NULL; return head; } Node* deletenode(int del, Node* head) { if(del==head->data) //del= data of first node return head->next; Node* temp=head; while(temp->next->data!=del) //loop till data of next node matches del { temp=temp->next; } temp->next=temp->next->next; //change link return head; } int main() { int n; cin>>n; Node* head=createlist(n); Node* temp=head; while(temp->data!=NULL) { cout
@SudakshinaMaitra2 жыл бұрын
thanks man
@jaykoranga4859 Жыл бұрын
i was thinking the same , what if we have to delete the first node . thnxx
@UECAshutoshKumar Жыл бұрын
Thank you
@stardust8572 жыл бұрын
My code for deletion, although I am a beginner, plz point out my mistakes. void delete_node(node* &head,int val) { node* temp=head; if(head->data==val) { delete head->next; head=temp->next; } else { while((temp->next)->data!=val) { temp=temp->next; } node* temp1=temp; delete temp->next; temp1=(temp1->next)->next; temp->next=temp1; } }
@tanmayasamaltk644 жыл бұрын
Great content 😍, no words to describe how thankful I am to the team Apna college🙏.
@vivek_13002 жыл бұрын
nice video
@harshpanwar15502 жыл бұрын
Thank u didi😄
@_rahulsain4 жыл бұрын
If you need to copy the code, check this repo -> github.com/rahulsain/CPP-DSA
@abhishekkhare61753 жыл бұрын
without delete at head function : void deletingANode(node* &head,int val) { node *temp=head; if (head==NULL) { coutdata==val) { node *todelete=temp->next; temp->next=temp->next->next; delete todelete; break; } temp=temp->next; } }
@ankitgupta16444 жыл бұрын
please add some brief dryrun at the end of the lectures , its a vital request to the apna college team
@summerkoushal6792 жыл бұрын
I'd a doubt ... When size of list is 1, there we are deleting the head. Don't we need to check whether head->data should be Val. Why we are deleting that head every single time when link list is of size 1.
@mjgaming70316 ай бұрын
Yes today my professor taught you are right👍🏻
@sahilsawal4 жыл бұрын
Thank You Maam :) 🙏🏻👍🏻✌🏻👌🏻😇
@pradhanan94134 жыл бұрын
Which year student you are?
@r.h.43922 жыл бұрын
#include using namespace std; class node{ public: int data; node *next; }; void deleteNode(node* &head, int val){ if(head == NULL){ coutnext; } node *delnode = temp->next; temp->next = temp->next->next; delete delnode; // deleting the non-required allocated memory block ; } void deleteAtHead(node* &head){ // delete the node from first place node* delnode = head; head = head->next; delete delnode; } void display(node *head){ node* temp = head; while(temp!=NULL){ coutnext = two; two->data = 20; two->next = three; three->data = 30; three->next = four; four->data = 40; four->next = NULL; display(head); cout
@aftabyt38942 ай бұрын
Didi ki voice pahale or ab m kafi farak hai. 😅
@madanmohan56612 жыл бұрын
What to do if the value we want to delete is repeated sometimes in the linked list?
@Justin_Roy4 жыл бұрын
MAKE LONG VIDEO ON LINKED LIST please
@_rahulsain4 жыл бұрын
Copy paste code from here -> github.com/rahulsain/CPP-DSA/blob/master/Phase%201%20Placement%20Specific/28.%20Linked%20List/implementation.cpp
@anuragpandey33413 жыл бұрын
Finally some animation work is present
@rajeevranjan3690 Жыл бұрын
Heap memory wala smjha Diya hota it would be grt using destructor
@DexterMylove4 жыл бұрын
Aman bhaiya and team OP
@nikitasingh1054 жыл бұрын
🙏 thanku bhaiya
@roaster24833 жыл бұрын
Awesome series so far🥰
@islamulhaq45372 жыл бұрын
Didi yeh new node declare karta howa ap * kiun dalta ho wo pointer declare karan ka liya nai hota?? plz bata dain bahot confuse kar rha ha yeh
@mindspiredАй бұрын
😂😂 bhai isko samajhne k liya muje alag se course krna padega
@vaibhavpaliwal86863 жыл бұрын
DOUBT !!! Ma'am, I have commented "to_delete" node, as you can see below, the code is working properly, so why are we creating a node and then deleting that element. void deletion(node *&head, int val) { if (head == NULL) return; if (head->next == NULL) { deletionAtHead(head); return; } node *temp = head; if (temp->next->data != val) { temp = temp->next; } // node *todelete = temp->next; temp->next = temp->next->next; // delete todelete; }
@vaibhavpaliwal86863 жыл бұрын
Ma'am is this explanation correct !!! we are pointing to that node which we want to delete, this is done so that hume pata ho ki jo node hum delete kr the hai vo memory me kaha pe hai wrna memory leak ho jayegi.
@sahiljindal4 жыл бұрын
If there's only one element present in the linked list, then it should be checked, instead of just deleting it 🙄, Also this deletion by value function only works correctly when there are unique values in the linked list, in case of repeating elements, it will delete the first occurrence of the element present in the linked list
@MohammadKhan-ld1xt4 жыл бұрын
Do you have a better option
@sahiljindal4 жыл бұрын
@@MohammadKhan-ld1xt yess, definitely
@MohammadKhan-ld1xt4 жыл бұрын
@@sahiljindal how would you do it
@palashagrawal23434 жыл бұрын
so for that use while loop till temp=NULL and use if statement inside it to delete same occurrence value.
@strgglr46373 жыл бұрын
Missed 1 corner possiblity which is if we have only 1 element in our linked list then if we execute deletion() then that element will be deleted but it should only be deleted if deletion(head, the remaining element) is executed else it should return that element in display(head).
@paragramteke67392 жыл бұрын
Consider 1->2->3 and we want to delete 1 then code fails as theres no check if(head->data == val) deletehead
@ankitgupta16444 жыл бұрын
brilliantly explained
@deepakparwani63433 жыл бұрын
I think this not work if we want to delete head ? @ApnaCollege
Please upload the same short video like this for every point or every question everyday. It will be easy to analyse the topic clearly in short video. BTW Great Explanation. Thank You.
@pradhanan94134 жыл бұрын
Which year student you r?
@chitranshuvarshney44233 жыл бұрын
Mam, Error is coming in the last when you delete the elements.
@abhishekgadewar46163 жыл бұрын
declare deleteAtHead function before deletion function
@ayushkamboj28123 жыл бұрын
6:15 u should check that element is equal to val or not
@nissankumar97493 жыл бұрын
yeah even i pointed that out
@daniyal044 жыл бұрын
👍
@sakshithakur84654 жыл бұрын
Didi I don't mean to be rude but please tell me how am I suppose to study STL and all don't jump so much just for the sake of completing syllabus.
@Prashantkumar-ji5bp3 жыл бұрын
@sohamvyas57094 жыл бұрын
thank u bhaiya
@bscwala68414 жыл бұрын
Nice
@ScienceExplorer00110 ай бұрын
What is temp?
@JayantBansal3 жыл бұрын
DOUBT - I just noticed that I am not putting '&" operator in the function parameter(yes i m declaring pointer variable)then too its working fine , so is it fine to not put it??, and since you are putting it what are the benefits? I am using -- void deletehead(node* head) RATHER then void deletehead(node* &head)
@JayantBansal3 жыл бұрын
If anyone knows the answer please answer it.
@rheotv18593 жыл бұрын
Its not working on mine ...
@JayantBansal3 жыл бұрын
@@anshumankumarnathshahdev3090 in void insertattail function if(head==NULL){ head=n; (add this ->)return ; }
@anshumankumarnathshahdev30903 жыл бұрын
thanks bro 😊
@music-003 жыл бұрын
bro she used "&" just to make changes in head, if u use it directly it won't change the head in main function.
@avishkartembhurne28804 жыл бұрын
Aman bhaiya 12 notes kab ayenge
@ritikkaushik34933 жыл бұрын
In last edge case you redirect to deleteAtHead function but what if the val that comes is not at the head. so we have to write this condition too. if(head->next==NULL && head->data==val){ deleteAtHEad(head);}
@abhishekgadewar46163 жыл бұрын
I guess she did this assuming that the term we want to delete is present in the linked list so if only one node is there then the term has to be at the head.
@ritikkaushik34933 жыл бұрын
@@abhishekgadewar4616 In programming you have to take a base cases ... don't try to just assume .. code that edge case otherwise you will stuck in Test cases.
@abhishekgadewar46163 жыл бұрын
@@ritikkaushik3493 yes even I had this in my mind beacuse it is possible that there are like 1, 2, 3, 4 nodes present but the val we want to delete is 6 which is not in the list itself. So this has to be considered as well but to keep it simple for now she may have assumed that
@ritikkaushik34933 жыл бұрын
@@abhishekgadewar4616 yupp👍
@AK-pv9lr4 жыл бұрын
Why is this video not monetised
@gdsclncte2 жыл бұрын
Please provide notes, it takes a lot of time to make notes by taking screenshots.
@abhisheksinha44563 жыл бұрын
Last node ka handle kiya kya
@b.a.n24182 жыл бұрын
osm
@Pankaj_kumr4 жыл бұрын
sir, why don't you enable monetization on these videos......................... ?
@rahul_ji213 жыл бұрын
Because he wants education to be free for all
@ankitshrestha64814 жыл бұрын
ek or case rhe gya deletion node from tail???
@BilalHussainButt3 жыл бұрын
kuch samj nahi aa rahi bhut fast ⏩⏩ parha rahi han mam. Aur naa hi enough explanation hai. kindly check
@harshitmaheshwari71854 жыл бұрын
bhaiya web d ke notes kab upload karoge
@patil_ji2 жыл бұрын
I am getting DeleteAtHead was not declared in this scope how?
@soumelee56612 жыл бұрын
nice :D
@ashishkhoiwal93303 жыл бұрын
nice one
@23ritik4 жыл бұрын
Please start DS algo using java which was left by anuj
@anormalgaming52624 жыл бұрын
Will you upload a course on c#? Plz reply
@praveentakpuriya54313 жыл бұрын
naa😁
@ThePurshottamKumar4 жыл бұрын
Ye dereferencing of pointer ka error aa Raha hai is question m, use kaise solve kre
@Ansar_Abbas2 жыл бұрын
koi ap ky pechy laga howa hy kia ??????????? itna jaldi jaldi parha rhi ho mam || please sary students ko sath ly k chaly || is mai week student bhi hy aur like bhi ye bhi dheyan mai rakhy || I think ap mery is commnet ko ignore nahi kro gi.
@anujsaini44544 жыл бұрын
Thnks bhaiya can we know that when this couse will be finished 🔥😘
@Whatever-jm2ul4 жыл бұрын
Abhi phase 1 bhi nahi huya bhai
@anujsaini44544 жыл бұрын
@@Whatever-jm2ul bro tere pass Intex h isse course ka ya link jaha se download ho jaye
@satyjeetkumar17344 жыл бұрын
Didi when I can run the code then the output line is. Collect 2.exe: error: 1d returned 1 exit status. Please tàke it my problem. I am stuck before 1month in 2nd vedeo. Please..................
@softwaredev81324 жыл бұрын
what is the code?
@cypher75363 жыл бұрын
Donot give space in naming a file..
@mitanshi68933 жыл бұрын
yrr aap bhut fast pdha rhe ho , or dry run bhi nhi kar rhe ho plz add some more explanation
@nottomention3 жыл бұрын
Why you not added a tail pointer initially ? Because i think it will be more easy to delete. Correct me if i am wrong.
@tomtanner40133 жыл бұрын
there is error in the code presented in the video i.e. if the key is not present we will get a error, for that I have made the below code void delete_key(node*&head,int key) { node *temp=head; //if the list is empty if(head==NULL) { coutnext==NULL) { coutnext; delete todelete;
yr kindly pora code to btao. ese smjha rahi ho jese hamein pehle se sb kch ata ho.
@HimanshuSharma-sf1yv4 жыл бұрын
First comment ... binod op
@hamdankhan1851 Жыл бұрын
Can you plz share source code ?? @Apna College
@mohammadanas79294 жыл бұрын
Thku mam❤️❤️
@varunchaudhary61013 жыл бұрын
Aman bhaiya ...didi bhaag rhi hein ..thoda sa dheeme smjhati to bdiya hota....yeh revision course thodi na hai...fir bhi yeh course best hai..ab kya krskte hein ...nii smjhaaega to baar baar dekhna pdega
@pushparajbhutekar26774 жыл бұрын
Web development ka jaldi dalo
@bhaibhai68653 жыл бұрын
bhaiya could u please give us the code of lectures??
@pratikshaw57443 жыл бұрын
in the description
@sawanpatel34913 жыл бұрын
@@pratikshaw5744 kha h bhai
@pratikkarad113 жыл бұрын
plz add some brief explanation....
@mohakgidwani15054 жыл бұрын
Notes ?
@dhruvrupareliya82874 жыл бұрын
Bhaiya ho seke to plz android devlopment pe ak source banao na plz bhaiya!
@jeelpatel14774 жыл бұрын
Sir can chemical engineer do MS in computer science?
@notEleven4 жыл бұрын
What if the node we want to delete is the last one... Isnt that another corner case??
@PulkitMalhotra4 жыл бұрын
yes
@sachinbairi63533 жыл бұрын
that is one of the corner cases but we can do that by deletion function bcoz for the last element their will be n-1 node and an n+1 node ( n+1 will be null) so, it will not throw an error.
@shreyak83333 жыл бұрын
Attach notes plz
@omsatpathy54552 жыл бұрын
5:45 humne already deleteAtHead() bna lia h so why do we need to check for one element in list? Can someone explain.Will really appreciate.
@randomotaku66842 жыл бұрын
agar humne usse banaya hai toh use call karna zaruri hai na bro