Тёмный
No video :(

How to create and display a Linked List in C programming 

BBarters
Подписаться 57 тыс.
Просмотров 329 тыс.
50% 1

In this video, we learn the program to create a Linked List of given length and then to display it.

Опубликовано:

 

6 сен 2017

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 199   
@unforgetable4747
@unforgetable4747 3 года назад
This is the hands-down BEST VIDEO I've found on internet explaining linked-lists. All videos from other people only use 2 nodes and that leaves no possibility of automating head->next = temp in while loop. You'd have to write manually such as head->next = temp, head->next->next = temp and so on. Using a 3rd node p really solved my problem on which I was stuck for quite long time. You're the best. THANK YOU VERY MUCH.
@shubhamjha4158
@shubhamjha4158 3 года назад
I was serious during the whole program. But when he said that this is a simple program, i laughed .
@ManishSharma-gp2qh
@ManishSharma-gp2qh 3 года назад
I understand bro 😏
@m.a.belkouri
@m.a.belkouri 3 года назад
hahahahaha
@debrajroy5170
@debrajroy5170 3 года назад
lol
@tanbiralam5829
@tanbiralam5829 6 лет назад
Sir you're really one of the best tutor I've ever seen..... I regularly follow you and recommended your channel to all my college mates.... keep uploading more contents for students like us. May god bless you
@dallasdominguez2224
@dallasdominguez2224 4 года назад
Great explanation. I like that you walk through the code step by step. It really helped me understand how linked lists work.
@tejasshelke2081
@tejasshelke2081 Год назад
Mere teacher se accha sikhya aapne sir 3 din se sar fod raha tha me aaj finally ek perfect video mila jo dekh kar samaj me aya thanks sir
@tumarisyalqun7327
@tumarisyalqun7327 5 лет назад
Thank you! This was one of the best explained tutorials I've seen so far:) very helpful
@PinoyOnlineClass
@PinoyOnlineClass 3 года назад
Oh my! Thank you! I've been racking my brain how to get this to work.
@BBarters
@BBarters 3 года назад
Happy to help!
@RahulPal1998
@RahulPal1998 4 года назад
best linked list implementation program ever explained every point in detail and I was try to do for about 3 day. and now every thing is cleared really thanks
@huec7184
@huec7184 2 года назад
This is absolutely the best video of linked list for beginners
@tabletuser123
@tabletuser123 Год назад
FINALLY AN ACTUAL GOOD VIDEO ON THIS TOPIC THANK YOU KING
@relaxationmusic3535
@relaxationmusic3535 Год назад
thanku so much sir for the clear explaination am searching for this type of video only where i can understand from basics.
@namrata1518
@namrata1518 3 года назад
Thank you so much! I was stuck in linked list. I got savior like you really if teachers will teach and explain each and everything like you DSA won't be boring. Again Thank you🙏
@aidenrhode8580
@aidenrhode8580 5 лет назад
probably the best explanation of ow to create a linked list
@Moukraan
@Moukraan 3 года назад
Thank you so much! I wonder why my college teacher couldn't explain like this
@chibbi9745
@chibbi9745 Год назад
I was very happy yesterday that I found your channel but after that I saw many videos i want are not there😓 It's ok I'm not blaming you sir it's just that I loved your teaching.
@zeus119
@zeus119 2 года назад
Woow nice. I think I learned linked list with 3 videos and ur video is the bigest step.
@luizhenriquebraunermoraes3175
@luizhenriquebraunermoraes3175 4 года назад
Your explanation is top-notch! Thanks a lot!
@tt1281
@tt1281 5 лет назад
Thank you sir , I was understanding nothing on linked list . Big thanks to your video
@franciscrypto9143
@franciscrypto9143 2 года назад
finally you save me from cramming! I'm used to head being a global variable so when the prof provide assignment that making the head as local variable, that's where i stuck up to
@eduard289
@eduard289 2 года назад
Best tutorial for LINKED LIST IN C !!!!!!!!!!!!!!!!!!!!! the best !
@pyb.5672
@pyb.5672 6 лет назад
In a linked list, whenever you add a new node, there is no point adding it to the end of the list. This makes the operation O(n) which can take a very long time when you are adding your 1 millionth element to the list. Inserting a new node and attaching it to the former head and then defining it as the new head, takes a lot less time, O(1). If you do this, your list is reversed and checking whether an element is in the list or printing all the data in the nodes will take just as much time.
@DS-me7kk
@DS-me7kk Год назад
Great explanation. Although I wish you used curly braces on that while loop...took me a day to realize next line is outside of the loop
@vikitor21
@vikitor21 5 лет назад
Thanks a lot! It was very helpfull. Salutations from Brazil
@nikitabiswas1061
@nikitabiswas1061 2 года назад
Thank you so much sir. Was stuck on this for quite a long time.
@eliy5550
@eliy5550 3 года назад
THANK YOU . YOU LITERALLY SAVED ME BRO
@udaykirantheegala439
@udaykirantheegala439 2 года назад
awsome sir i had sarched many website but i didn't find tq sir
@AnkitSaiyan
@AnkitSaiyan 5 лет назад
Or we can use do while loop to successfully print the last node using logic condition (p->next != NULL)
@ashwingoku5120
@ashwingoku5120 4 года назад
Great explanation. I understood linked list very well
@BBarters
@BBarters 4 года назад
Glad it was helpful!
@idangaray4398
@idangaray4398 5 лет назад
Thanks for the video, one of the understandable video I've ever seen about linkedl list
@santiherrera807
@santiherrera807 5 лет назад
Am I the only one seeing a mistake in the printf argument??? The code should not compile, I mean, I do not like when someone hides his mistakes just to make everything seem perfect.
@yashgajewar9019
@yashgajewar9019 3 года назад
just great explanation thank you a lot sir this was very helpful
@BBarters
@BBarters 3 года назад
Glad it was helpful!
@maumitadas4332
@maumitadas4332 2 года назад
Awesome explanation... Thanks you very much ✅
@SONUKUMAR-sy7op
@SONUKUMAR-sy7op 4 года назад
Thank you sir for well explanation. Sir I want lecture of data structure Please help me.
@HakuzaPK
@HakuzaPK 11 месяцев назад
is * and -> the same thing in c?
@djankies
@djankies 3 месяца назад
*node.data is the same as node->data. The dereference operator (*) is used to retrieve the actual node instead of the memory address (since node here is a pointer). Then dot notation to access variables in that node struct. The arrow operator (->) combines those two steps into one.
@JohnBonwa
@JohnBonwa 3 месяца назад
Thx 🙏🏻 ​@@djankies
@thelosttomato4020
@thelosttomato4020 3 месяца назад
p->data is the same as (*p).data
@dzbro1194
@dzbro1194 3 месяца назад
you be smashing that keyboard
@arjunty
@arjunty Год назад
here is the exact code,hope this helps . . #include #include struct node{ int data; struct node*next; }; void displaylist(struct node*head); struct node *createlinkedlist(int n); int main() { int n=0; struct node* HEAD=NULL; printf(" how many nodes:"); scanf("%d",&n); HEAD=createlinkedlist(n); displaylist(HEAD); } struct node *createlinkedlist(int n)//function to create a single ll and add to end { int i; struct node*head=NULL; struct node*temp=NULL; struct node*p=NULL; for(i=0;idata)); temp->next=NULL; if(head==NULL) //if head is empty make temp as first node { head=temp; } else { p=head; while(p->next!=NULL) p=p->next; p->next=temp; } } return head; } void displaylist(struct node*head)//function to display code { struct node*z=head; while(z!=NULL) { printf("%d->",z->data); z=z->next; } } note-i did not use typedef because i prefer using struct node instead of node.
@rajkishorprasad4707
@rajkishorprasad4707 4 года назад
Sir, yr explaining way is perfect 🤗
@shobhitranjan3957
@shobhitranjan3957 6 лет назад
This really helped me !
@divyabhagat7375
@divyabhagat7375 3 года назад
I keep getting an error warning: data argument not used by format string for printf(" Enter the data for node number:", i+ 1); I don't know how to fix this
@mathemagician7683
@mathemagician7683 3 года назад
Add %d after the number word
@udaykirantheegala439
@udaykirantheegala439 2 года назад
but sir when i written same code the erron was comming at this line node* creareList(int n) the error is conflicting type error what should i do
@rishabhpathak6115
@rishabhpathak6115 2 года назад
R.I.P to keyboard keys.....btw nice explanation
@siddharthhiremath9964
@siddharthhiremath9964 5 лет назад
This is really helpful!
@humayqanizade4600
@humayqanizade4600 2 года назад
Good explanation.Thank you!
@Burak-cr6um
@Burak-cr6um 2 года назад
Thank you! it was very helpful.
@prestonyates3379
@prestonyates3379 Год назад
My head node changes with every iteration, even after the first. It only does the if statement once but if temp changes so does head. How do you fix this?
@kwadh8629
@kwadh8629 6 лет назад
sir please could you do Data Structures in one video....or maybe a playlist....especially with respect to interview
@huhu698
@huhu698 3 года назад
Thank you so much for this. You helped me a lot.
@BBarters
@BBarters 3 года назад
Glad I could help!
@wrnlb666
@wrnlb666 2 года назад
Don't u like, free the memory for LinkedList?
@johngates2602
@johngates2602 3 года назад
Good explanation sir thanks.
@BBarters
@BBarters 3 года назад
You are welcome!
@harshsinha9709
@harshsinha9709 3 года назад
best till date.....
@GMAbdullahAl-Kafi
@GMAbdullahAl-Kafi 3 года назад
Thank you! The vedio help me a lot.
@mramzanali8156
@mramzanali8156 3 года назад
sir ap k lactures bhut a6y han add more lactures in linked list all operation
@BBarters
@BBarters 3 года назад
Surely, that is on the agenda. Will be doing that soon.
@mramzanali8156
@mramzanali8156 3 года назад
@@BBarters thaks you sir
@ajayshankaradepu4686
@ajayshankaradepu4686 2 года назад
to many arguments issue: cmd terminal ,please help me in solving it. printf(" enter the node numbers: ",i+1);
@edwardhaybell1938
@edwardhaybell1938 3 года назад
Ahhh, I finally got what I did wrong! Thank you man!
@user-zy8sf7tv2f
@user-zy8sf7tv2f 3 года назад
Thanks a lot ! You help me very much!
@dexteravejero3208
@dexteravejero3208 Год назад
is it possible to display the 1st index on a linked list
@jashwanthms740
@jashwanthms740 3 года назад
Awesome explaination
@BBarters
@BBarters 3 года назад
Glad you liked it!
@hrithikjoshi6918
@hrithikjoshi6918 5 лет назад
you did what my professor couldn't.......
@NaveenSingh-js6ts
@NaveenSingh-js6ts 4 года назад
Thank you for explaining the code so neatly....♥️
@___.itz__.__naazzz.__
@___.itz__.__naazzz.__ 3 года назад
Hiii
@segniguta6569
@segniguta6569 4 года назад
Does the while loop in the createLinkedList function operate? I mean since it is always false? Because p is always set to head, and head has always head->next = NULL.
@tanyasingh4421
@tanyasingh4421 3 года назад
Hey did you get the answer. Please tell me tok
@tanyasingh4421
@tanyasingh4421 3 года назад
*too
@emmechess2396
@emmechess2396 2 года назад
@@tanyasingh4421 yes
@pepperdayjackpac4521
@pepperdayjackpac4521 2 года назад
do we need to free the memory with free()?
@umbranocturna6342
@umbranocturna6342 4 года назад
very nice tutorial.
@inhVietQuangbi-
@inhVietQuangbi- 2 года назад
if i want to count node can i use this code?: void getcount(node*head){ int count=0; struct node*current; current=head; while(current!=NULL){ count++; current=current->next; } printf("the lenght of the train is:%d",count); return count; } in main () { getcount(HEAD); }
@rblxmach
@rblxmach 2 года назад
are you able to add stuff to the linked list in the console?
@joseantoniojunior5460
@joseantoniojunior5460 3 года назад
Thanks for the tutorial!
@shrinathdarur5184
@shrinathdarur5184 5 лет назад
Thank you , nice explanation!
@zohramoiz6177
@zohramoiz6177 5 лет назад
finally.....thank u so much sir
@cyrilc189
@cyrilc189 5 лет назад
I don't think it is absolutely necessary to iterate the existing list to attach to a new node to the last node. A simple node pointer variable, say "node *previous" can be used for this purpose in the else clause, thus: if(head == NULL) { ... } else { previous->next = temp; } Then at the end of the for loop the following assignment will ensure that "previous" is assigned a valid value for subsequent iterations and therefore, keeps track of the last created node for(...) } .... previous = temp; }
@aniketsalunkhe4438
@aniketsalunkhe4438 Год назад
Bhai ye code detail mai likho na pls
@ravikumargantla7998
@ravikumargantla7998 6 лет назад
i will share this with my friends
@vishaltanawade7637
@vishaltanawade7637 5 лет назад
Which software you use for c programming
@ymenseus
@ymenseus 4 года назад
it's CLion
@gamingfundas
@gamingfundas 5 лет назад
Sir i executed this code and it is taking inputs(valur of nodes) correctly but when its the time of display then it is showing an infinite loop....plzz help
@slippyfist747
@slippyfist747 2 года назад
Man wish i found this video when i was taking data structures 8 years ago, maybe i wouldnt have switched to a useless physics degree
@masonwong4518
@masonwong4518 4 года назад
sir, this is very inefficient. u keep setting p back to head instead of keeping it at the end of the list. can you please make a tutoriol to make a more efficient list perhaps?
@ArifMahmood
@ArifMahmood 5 лет назад
What if we replace code line int data with line An_element data where An_element is a struct and it has a single member int integer. If I do it in your code I see exception on line temp=(node*)malloc(sizeof(node)). I m trying to learn struct use on a list like this.
@dipakmishra7239
@dipakmishra7239 5 лет назад
Thankq Sir, this help me a lot.
@christinasamuel4994
@christinasamuel4994 2 года назад
Sir, can you show me how to read values from struct manual input and passing a pointer containing name, id and cgpa to linked list. Thank you.
@alanouri9965
@alanouri9965 4 года назад
thank's broo, it was helpful
@BBarters
@BBarters 4 года назад
You're welcome!
@babukamal473
@babukamal473 3 года назад
very good...
@daniellima6590
@daniellima6590 3 года назад
theres a way to rank those numbers in crescent order?
@kedarjani4396
@kedarjani4396 4 года назад
i will not write a long comment but , thank you SO MUCH for this...
@BBarters
@BBarters 4 года назад
You're very welcome!
@menifestationtechniques5921
@menifestationtechniques5921 2 года назад
great sir
@carlosmarx3193
@carlosmarx3193 4 года назад
is there a video about operations of linked lists like insert delete on your chanel?
@NHCS_MABUD
@NHCS_MABUD 4 года назад
Hi Sir which compiler you are using?
@stephenkolluri2856
@stephenkolluri2856 2 года назад
do we have to free malloc?
@atharvabetawadkar7865
@atharvabetawadkar7865 2 года назад
where can i get a video where a character is used instead of integer data to make a linked list
@mdrajibhasnat2321
@mdrajibhasnat2321 Год назад
Amazing🥰
@mahlatsekhoza1780
@mahlatsekhoza1780 6 лет назад
It helped me a lot
@parag263
@parag263 2 года назад
Thank You so much
@rajkumar-uk6hk
@rajkumar-uk6hk 3 года назад
i tried the same code but it showing segmentation fault
@EzioAuditore-vr1oy
@EzioAuditore-vr1oy 3 года назад
This stuff is so complex for a beginner, my prof acts like its nothing.
@sankethb.k642
@sankethb.k642 5 лет назад
Thanks a lot sir
@ARUNKUMAR-cn4ne
@ARUNKUMAR-cn4ne 5 лет назад
Excellent Sir
@carlosmercado2780
@carlosmercado2780 6 лет назад
Nice video. Which IDE are you using?
@playdagameythd6069
@playdagameythd6069 3 года назад
For me it's not printing the last number, for example i input the number 5,6,8,7,4 and it prints 5->6->8->7 Anyone help?
@hellostelly
@hellostelly 5 лет назад
Thank you!!!
@alvislim515
@alvislim515 5 лет назад
Hi Sir, how can we do to delete the particular node. Any video of yours? Appreciate on it =)
@kaansimsek9961
@kaansimsek9961 3 года назад
I write this code and when I tried my output was 1-> 2-> 33->9772504... My input was 1,2,33. Why 9772504 occurs in my code. Can anybody help?
@josemanuelruizgonzalez9353
@josemanuelruizgonzalez9353 3 года назад
Because it overflows the integer, the max number you can use is 32,767 or twice if it's an unsigned int
@piyushverma1077
@piyushverma1077 5 лет назад
very helpful thank you
@deepaksoni8906
@deepaksoni8906 5 лет назад
awesome one
@ferdoushasan6823
@ferdoushasan6823 2 года назад
Thank you so much 💖
Далее
NOOOO 😂😂😂
00:14
Просмотров 15 млн
Winning Facebook (Meta) Hacker Cup Qual Round 2022?
53:55
Reverse a Single Linked List
11:57
Просмотров 252 тыс.
Creating the Node of a Single Linked List
6:00
Просмотров 994 тыс.
Linked Lists in C for Beginners #1 - Introduction
15:33
Learn Linked Lists in 13 minutes 🔗
13:24
Просмотров 280 тыс.