So simple to understand after seeing singly linked list lectures. Thank you❤❤
@Anurag_singh513 жыл бұрын
my favourite channel....NESO ACADEMY
@satvikshukla5963 жыл бұрын
This looks soo simple, bcoz you taught it soo well. Thank you
@SumedhaChallagundla6 ай бұрын
Helped a lot. Thank you so much sir😊😊
@rnmali42432 жыл бұрын
Clean and clear 🔥
@sabbysays3 жыл бұрын
Thanks a ton sir! Please try increasing upload frequency.
@tahirnawaz98212 жыл бұрын
Thank you sir very helpful video God bless you, amazing concept,, keep it up,,.
@kiranhaya90993 жыл бұрын
My favourite channel and my favourite Sir....What is the name of the sir?
@sr-sunny-raj3 жыл бұрын
Greatttt🔥🔥🔥🔥🔥
@dipeshsamrawat79573 жыл бұрын
I love Neso Academy :)
@01.abhishekkumar333 жыл бұрын
Outstanding lecture
@elhadimohamed13363 жыл бұрын
You're the best ✌️
@PROTECHRAHUL3 жыл бұрын
U r genius sir😍
@boblopez7649 Жыл бұрын
node_t * add_new_node(int data , node_t *ptr) { node_t *temp=(node_t*)malloc(sizeof(node_t)); temp->data=data; temp->next=NULL; temp->prev=ptr; ptr->next=temp; return temp; } I think using this would reduce time complexity cuz there is no loop ....
@tahirnawaz98212 жыл бұрын
Thanks a lot sir love you,,.
@aashishbhatt48883 жыл бұрын
Please upload videos fast
@sonysayannagari28893 жыл бұрын
In addAtEnd function, head is not getting changed right..so we can just delclare addAtEnd function of void type right?
@shivp4363 жыл бұрын
Head is not getting changed yes, you can make it void. But if you want to keep a pointer tp pointing at the last node of the list.. which is helpful when you add next node, you should return the updated pointer .. so you can't make it void.. If you still want to make it void. You can use call by reference method
@Dnsx_plus3 жыл бұрын
No need to return anything, makes no difference for this method of inserting a node at the end look at this: #include #include #include // Not required, just like importing this library typedef struct node{ struct node * prev; int data; struct node * next; }Node; Node * AddNodeToEmptyList(Node* Head, int Data) { // Initializes Head Pointer Node * temp = (Node*)malloc(sizeof(Node)); temp -> prev = NULL; temp -> data = Data; temp -> next = NULL; Head=temp; return Head; } Node * AddNodeAtBeginning(Node* Head, int Data) { // Inserts node in the beginning, taking place as a new head Node * Temp = (Node*)malloc(sizeof(Node)); Temp->prev = NULL; Temp->data = Data; Temp->next = Head; Head->prev = Temp; Head->next = NULL; Head=Temp; // Have to change where the head is pointing, it has to point to the new updated node, which // Was added at the beginning, so the old node has to be updated and the Head pointer will point to the // Newely added node. return Head; } void AddNoteAtEnd(Node* Head, int Data) {// Adds a Node at the end of the Linked List Node* Temp = Head; while(Temp->next != NULL) { Temp = Temp->next; } printf("Last node's value: %d", Temp->data); Node* NewNode = (Node*)malloc(sizeof(Node)); NewNode->prev = Temp; NewNode->data = Data; NewNode->next = NULL; Temp->next = NewNode; Temp = Head; while(Temp != NULL) { printf(" Node data: %d ", Temp->data); Temp = Temp->next; } // return Head; } int main() { /* Unlike a single-linked list a double linked list's node consists of two pointer, one for the previous node, the next, and the data segment. This is good news since now we can access the previous and next node in the linked list. */ Node * Head = AddNodeToEmptyList(Head, 2); Head = AddNodeAtBeginning(Head, 1); // Head = AddNoteAtEnd(Head, 3); // Head = AddNoteAtEnd(Head, 4); AddNoteAtEnd(Head, 3); AddNoteAtEnd(Head, 4); free(Head); Head = NULL; return 0; }
@techknowgemes78603 жыл бұрын
sir do we need to write ptr-next for traversing ??
@Ashhlleeeeyyy11 ай бұрын
why is all nodes named head?????? just name the other 2 current
@mr_blaze623 жыл бұрын
Thank you sir❤️
@subhajitchoudhury49812 жыл бұрын
i love you NESO you are not in earth
@kashafrafique0508 Жыл бұрын
Thankuuu sir
@BiqSam2002Ай бұрын
Neso Academic is my college
@janhvitolambe33313 жыл бұрын
Sir please upload complete series of ds.... It's kind request plz sir🤞✨
@nesoacademy3 жыл бұрын
Yes, we're creating the videos regularly and soon the course will be over.
@janhvitolambe33313 жыл бұрын
@@nesoacademy okay sir ji😁
@Dnsx_plus3 жыл бұрын
@@nesoacademy good job
@himaldangi93994 ай бұрын
Also post algorithm
@abdokako38833 жыл бұрын
we hope course for c++ or data structure & algorithms & Design patterns with c++
@anshikayadav78573 жыл бұрын
Sir please explain this:- We're using "struct node *_____; " so this means ___ will contain data & link too. So whenever we're creating any new pointer why don't we use int. Because if we're using struct node * then everytime it'll create a new node due to struct node data type. Please explain anyone can do so please.
@shivp4363 жыл бұрын
When we use struct node *x; It just creates a pointer to some non existing memory location; it does not allocate any memory or link; To allocate memory , we use the malloc function. And our pointer x automatically links to the allocated memory location. Hope this helps you.
@anshikayadav78573 жыл бұрын
@@shivp436 Thankyou
@ayushanand49903 жыл бұрын
when will u sum up the course
@Dnsx_plus3 жыл бұрын
Wrote my own version before watching the video, let's hope I did it right! #include #include #include // Not required, just like importing this library typedef struct node{ struct node * prev; int data; struct node * next; }Node; Node * AddNodeToEmptyList(Node* Head, int Data) { // Initializes Head Pointer Node * temp = (Node*)malloc(sizeof(Node)); temp -> prev = NULL; temp -> data = Data; temp -> next = NULL; Head=temp; return Head; } Node * AddNodeAtBeginning(Node* Head, int Data) { // Inserts node in the beginning, taking place as a new head Node * Temp = (Node*)malloc(sizeof(Node)); Temp->prev = NULL; Temp->data = Data; Temp->next = Head; Head->prev = Temp; Head->next = NULL; Head=Temp; // Have to change where the head is pointing, it has to point to the new updated node, which // Was added at the beginning, so the old node has to be updated and the Head pointer will point to the // Newely added node. return Head; } Node * AddNoteAtEnd(Node* Head, int Data) {// Adds a Node at the end of the Linked List Node* Temp = Head; while(Temp->next != NULL) { Temp = Temp->next; } printf("Last node's value: %d", Temp->data); Node* NewNode = (Node*)malloc(sizeof(Node)); NewNode->prev = Temp; NewNode->data = Data; NewNode->next = NULL; Temp->next = NewNode; Temp = Head; while(Temp != NULL) { printf(" Node data: %d ", Temp->data); Temp = Temp->next; } return Head; } int main() { /* Unlike a single-linked list a double linked list's node consists of two pointer, one for the previous node, the next, and the data segment. This is good news since now we can access the previous and next node in the linked list. */ Node * Head = AddNodeToEmptyList(Head, 2); Head = AddNodeAtBeginning(Head, 1); Head = AddNoteAtEnd(Head, 3); Head = AddNoteAtEnd(Head, 4); free(Head); Head = NULL; return 0; }
@reverbism2 жыл бұрын
Noice
@divinitygod6002 Жыл бұрын
This malloc goes over my head...... c++ is easier. we just use "new" variable for that whole gunk.
@xkostmand62572 жыл бұрын
at 1:45 , would this work? temp->prev=&(tp->next);
@Ayush37262 Жыл бұрын
That Worked?? I think it shouldn't work...
@meditationmusicforpositive87983 жыл бұрын
where do I get the code of all these ?
@ritikshrivastava94423 жыл бұрын
//insertion at the end of the doubly linked list #include #include struct node{ struct node *prev; int data; struct node *next; }; struct node * add_at_beg(struct node *head, int data) { struct node *temp = malloc(sizeof(struct node)); temp->prev=NULL; temp->data=data; temp->next=head; head->prev=temp; head=temp; return head; } void add_at_end(struct node * head, int data) { struct node *temp2 = malloc(sizeof(struct node)); temp2->prev=NULL; temp2->data=data; temp2->next=NULL; struct node *trav=head; while(trav->next!=NULL) { trav=trav->next; } trav->next=temp2; temp2->prev=trav; } int main() { struct node *head=malloc(sizeof(struct node)); head->prev=NULL; head->data=45; head->next=NULL; head=add_at_beg(head,58); add_at_end(head,89); struct node *ptr=head; while(ptr!=NULL) { printf("%d ",ptr->data); ptr=ptr->next; } return 0; }
@vaibhavsingh3353 жыл бұрын
Sir how to convert y parameter to h parameter ,plz sir
@coders81803 жыл бұрын
i don't undestand why we are using *tp in place of tp...may u plz make me this to be understable
@luthfiardiansyah85303 жыл бұрын
I think *tp same as the iterator
@harikpriyatirumalaraju6743 жыл бұрын
PLS make video on QUICK SORT AND MERGE SORT
@bhupeshpattanaik71503 жыл бұрын
Please bring videos more frequently , as I can't follow along the syllabus ..... Your videos coming very slow
@YZ10003 жыл бұрын
sir i am getting segmentation fault (core dumped) error even though the code is 100% similar , what to do 🤔
@hustlinhr Жыл бұрын
Bhai code hi glt h to error to aaiga hi glt code h iska