Doubly Linked List (Insertion at the Beginning)

  Рет қаралды 169,414

Neso Academy

Neso Academy

3 жыл бұрын

Data Structures: Inserting a Node at the Beginning of a Doubly Linked List
Topics discussed:
1) C program for inserting a node at the beginning of a doubly linked list.
Data Structures: bit.ly/3hjudFV
C Programming: goo.gl/7Eh2SS
Follow Neso Academy on Instagram: @nesoacademy(bit.ly/2XP63OE)
Follow me on Instagram: @jaspreetedu(bit.ly/2YX26E5)
Contribute: www.nesoacademy.org/donate
Memberships: bit.ly/2U7YSPI
Books: www.nesoacademy.org/recommende...
Website ► www.nesoacademy.org/
Forum ► forum.nesoacademy.org/
Facebook ► goo.gl/Nt0PmB
Twitter ► / nesoacademy
Music:
Axol x Alex Skrindo - You [NCS Release]
#DataStructuresByNeso #DataStructures #DoublyLinkedList #LinkedList

Пікірлер: 53
@karthikj14
@karthikj14 3 жыл бұрын
You Guys make things easier...
@dipeshsamrawat7957
@dipeshsamrawat7957 2 жыл бұрын
I love Neso Academy :)
@01.abhishekkumar33
@01.abhishekkumar33 2 жыл бұрын
Awesome lecture sir
@sd12217
@sd12217 3 жыл бұрын
Sir plz complete the ds playlist your videos are really awesome
@arthia2801
@arthia2801 3 жыл бұрын
A very big thank you sir
@arthia2801
@arthia2801 3 жыл бұрын
A beru big thank you sir
@divyanshbalodhi5642
@divyanshbalodhi5642 Жыл бұрын
To the point teaching
@bbpharma3075
@bbpharma3075 3 жыл бұрын
Sir these videos are helping a lot because they are very understandable and you go point to point , I would request you to pls increase your speed of uploading videos because I would really like to keep up my course alongside your tutorial ,so that i am always updated , pls try and cover trees after this and then stacks and queues, if you can pls🙏
@amlansasmal
@amlansasmal 2 жыл бұрын
i have a question .... like in singly list we can create node inside the main func .. so can't we create that head node in this doubly linked list inside the main finc ?? please clear my doubt !
@abbikgg3992
@abbikgg3992 9 ай бұрын
@@amlansasmal Yes, of course we can. We can create head flag inside the main function, but we usually create structs globally, so that every function can reference it
@sohelansari-dq5kv
@sohelansari-dq5kv 3 жыл бұрын
Thank you sir for uploading this video...it's very helpful
@amlansasmal
@amlansasmal 2 жыл бұрын
i have a question .... like in singly list we can create node inside the main func .. so can't we create that head node in this doubly linked list inside the main finc ?? please clear my doubt !
@yusraansari8320
@yusraansari8320 3 жыл бұрын
Thanks a lot for these videos !
@amlansasmal
@amlansasmal 2 жыл бұрын
i have a question .... like in singly list we can create node inside the main func .. so can't we create that head node in this doubly linked list inside the main finc ?? please clear my doubt !
@abouhashim100
@abouhashim100 3 жыл бұрын
thx. for the incredible series of videos. but didn't we suffer from memory leak because we didn't free the space and pointers created throw the secondary functions, and if true how could we do that?
@kunalsoni7681
@kunalsoni7681 3 жыл бұрын
Really very helpful video 😊 too much 🥰😍
@amlansasmal
@amlansasmal 2 жыл бұрын
i have a question .... like in singly list we can create node inside the main func .. so can't we create that head node in this doubly linked list inside the main finc ?? please clear my doubt !
@tejatej3628
@tejatej3628 3 жыл бұрын
Thank ❤u sirr for ur quick response
@amlansasmal
@amlansasmal 2 жыл бұрын
i have a question .... like in singly list we can create node inside the main func .. so can't we create that head node in this doubly linked list inside the main finc ?? please clear my doubt !
@rishikadhakad1133
@rishikadhakad1133 Жыл бұрын
@@amlansasmal yes we can create
@explorerars4208
@explorerars4208 5 ай бұрын
wow sir
@shivamprasad4560
@shivamprasad4560 3 жыл бұрын
thank you so much sir for videos....plz upload more videos
@amlansasmal
@amlansasmal 2 жыл бұрын
i have a question .... like in singly list we can create node inside the main func .. so can't we create that head node in this doubly linked list inside the main finc ?? please clear my doubt !
@sabbysays
@sabbysays 3 жыл бұрын
Thanks for the great explanation sir. But please increase video frequency 🙏
@amlansasmal
@amlansasmal 2 жыл бұрын
i have a question .... like in singly list we can create node inside the main func .. so can't we create that head node in this doubly linked list inside the main finc ?? please clear my doubt !
@sudeepmulumudi
@sudeepmulumudi 3 жыл бұрын
helpful videos ,,,,do more
@amlansasmal
@amlansasmal 2 жыл бұрын
i have a question .... like in singly list we can create node inside the main func .. so can't we create that head node in this doubly linked list inside the main finc ?? please clear my doubt !
@amlansasmal
@amlansasmal 2 жыл бұрын
i have a question .... like in singly list we can create node inside the main func .. so can't we create that head node in this doubly linked list inside the main finc ?? please clear my doubt !
@_nabin_8848
@_nabin_8848 11 ай бұрын
Actually we can. For that you can try this code: #include #include typedef struct node{ int a; struct node *p, *n; }node; void add_node(node **p, int a){ node* temp=(node*)malloc(sizeof(node)); temp->n=NULL; temp->p=(*p); temp->a=a; (*p)->n=temp; (*p)=temp; } void out(node *p){ while(p!=NULL){ printf("%d\t",p->a); p=p->n; } } int main() { node *head=(node*)malloc(sizeof(node)); head->n=NULL; head->p=NULL; head->a=10; node *current=head; add_node(&current,20); add_node(&current,30); add_node(&current,40); current=head; out(current); }
@techknowgemes7860
@techknowgemes7860 2 жыл бұрын
sir does here ptr prev will contain null ?
@amlansasmal
@amlansasmal 2 жыл бұрын
i have a question .... like in singly list we can create node inside the main func .. so can't we create that head node in this doubly linked list inside the main finc ?? please clear my doubt !
@thewolverine5591
@thewolverine5591 3 жыл бұрын
🙏
@shafarazkhurshid2909
@shafarazkhurshid2909 2 жыл бұрын
nice expalnation..
@amlansasmal
@amlansasmal 2 жыл бұрын
i have a question .... like in singly list we can create node inside the main func .. so can't we create that head node in this doubly linked list inside the main finc ?? please clear my doubt !
@dsdcp
@dsdcp 3 жыл бұрын
can any one save me some time cause i have forgotten why did he put a pointer "ptr" to receive "head" to the loop??? why do not do it straight with "head"?
@shubhammandal6735
@shubhammandal6735 3 жыл бұрын
It will overrite the head so they are using a ptr Node to mimic the head.
@anotherfella7140
@anotherfella7140 4 ай бұрын
2:13
@SUBHASHKUMAR-ix5mz
@SUBHASHKUMAR-ix5mz 2 жыл бұрын
Please make your c and Data structures video in hindi constant
@lexingtonjackson3657
@lexingtonjackson3657 Жыл бұрын
if you are in college you should watch in english so that you will be able to explain the terms efficiently in your future interviews,just my opinion.
@SUBHASHKUMAR-ix5mz
@SUBHASHKUMAR-ix5mz Жыл бұрын
@@lexingtonjackson3657 thanks ❤️
@kajalmondal9745
@kajalmondal9745 3 жыл бұрын
Sir how can we create memory efficient doubly linked list?
@shivp436
@shivp436 3 жыл бұрын
All linked lists are memory efficient, and that's one of the main reasons we use them. They are efficient and dynamic. 👍
@hetaeramancer
@hetaeramancer 3 жыл бұрын
@@shivp436 sometimes arrays are more memory efficient
@vengalrao5772
@vengalrao5772 2 жыл бұрын
@@hetaeramancer it's hard to data structures na ? Trees , etc in c language
@amlansasmal
@amlansasmal 2 жыл бұрын
i have a question .... like in singly list we can create node inside the main func .. so can't we create that head node in this doubly linked list inside the main finc ?? please clear my doubt !
@sapnap2468
@sapnap2468 2 жыл бұрын
@@amlansasmal tell me too if u got the ans..
@pratikwakati7023
@pratikwakati7023 Жыл бұрын
Is the code given even works?
@devakinandan23
@devakinandan23 Жыл бұрын
where the fuck is malloc in code?
@bananas_5856
@bananas_5856 Жыл бұрын
Is right there lol
@_nabin_8848
@_nabin_8848 11 ай бұрын
My approach #include #include typedef struct node{ int a; struct node *p, *n; }node; void add_node(node** p, int a){ node *temp=(node*)malloc(sizeof(node)); temp->p=NULL; temp->n=NULL; temp->a=a; (*p)=temp; } void link_node(node *n1, node *n2) { n1->n=n2; n2->p=n1; } void out(node *p) { while(p!=NULL){ printf("%d\t",p->a); p=p->n; } } } int main() { node *node1,*node2; add_node(&node1,10); add_node(&node2,20); link_node(node1,node2); out(node1); }
Doubly Linked List (Insertion at the End)
4:22
Neso Academy
Рет қаралды 99 М.
Llegó al techo 😱
00:37
Juan De Dios Pantoja
Рет қаралды 59 МЛН
Spot The Fake Animal For $10,000
00:40
MrBeast
Рет қаралды 193 МЛН
ОБЯЗАТЕЛЬНО СОВЕРШАЙТЕ ДОБРО!❤❤❤
00:45
路飞太过分了,自己游泳。#海贼王#路飞
00:28
路飞与唐舞桐
Рет қаралды 38 МЛН
every good programmer should know how to code this data structure (its easy)
21:08
Doubly Linked List (Insertion between the Nodes) - Part 1
6:19
Neso Academy
Рет қаралды 113 М.
Doubly Linked List | Insert, Delete, Complexity Analysis
17:17
Blue Tree Code
Рет қаралды 65 М.
Single Linked List (Inserting a Node at a Certain Position)
6:52
Neso Academy
Рет қаралды 291 М.
Fastest Way to Learn ANY Programming Language: 80-20 rule
8:24
Sahil & Sarra
Рет қаралды 807 М.
Llegó al techo 😱
00:37
Juan De Dios Pantoja
Рет қаралды 59 МЛН