See complete series on data structures here:
http://www.youtube.com/playlist?list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P
In this lesson, we have implemented doubly linked list data structure in C. We have written basic operations for traversal and insertion.
See source code here:
https://gist.github.com/mycodeschool/7429492
Lesson on Dynamic memory allocation:
https://www.youtube.com/watch?v=_8-ht2AKyH4
For practice problems and more, visit: http://www.mycodeschool.com
Like us on Facebook: https://www.facebook.com/MyCodeSchool
Follow us on twitter: https://twitter.com/mycodeschool
Amazon Auto Links: No products found.
at 13:35 shouldn’t head be 600 ?
Great videos by the way
try to avoid global variables
It’s the best “data structures” tutorial list I’ve seen in the planet !
Can we replace struct Node* GetNewNode(int x) function to void GetNewNode(int x) in 5:57
if head is not global variable then this code is suitable:
struct Nodes* insertOnTail(struct Nodes *head1,int x){
struct Nodes *newnode=NewNode(x);
struct Nodes *head=head1;
if(head == NULL){
head=newnode;
return head;
}
while(head->next != NULL){
head=head->next;
}
newnode->prev=head;
head->next=newnode;
newnode->next=NULL;
return head1;
}
Excellent Sir…I have cleared my doubt on insertAtHead…Pls upload videos for all position operations(middle,end,given position)
Also what do you mean by :
head -> prev = newNode;
newNode -> next = head;
head = newNode;
should we not write :
head = newNode;
newNode -> prev = head;
what about the delete function? (the head/ tail/ nth location)
couldn’t find it in your source code
great tutoring btw 🙂
This is beautiful. Thank you for taking your time and effort in explaining how to implement doubly linked lists as well as their actions on the different memory locations. You possess great pronunciation, clarity, knowledge, and appropriate talking speed. Thank you!
thank you for making things simpler.
sir ji u r great teacher
From 8:16 onwards won’t it be 4 that will be stored in the address 600
You do an amazing job at making stuff sound simple. Your help is much appreciated and inspiring. Thank you, thank you so much.
your videos are helpful .I learned more good knowledge .
that was really amazing, .
BUT I AM QUITE WEAK AT THE BASICS, IS THERE ANY VIDEO OF YOURS WHICH WILL HELP ME CLEARING ALL MY BASICS FOR DATA STRUCTURES.
Is it necessary to explicitly make temp -> prev and temp -> next point to NULL when making a new node ?
it completely should be in c++, why c ,why malloc ?
for c++ seeker i dont think it is enough . 🙁
sorry
Thank you, finally getting to understand how DLL work
is this a good approach , i just included a constructor which set next and prev to NULL , so that we dont need to worry about setting up next and prev while inserting a new node ?
struct node
{
node *next;
node *prev;
int data;
node()
{
next=NULL;
prev=NULL;
}
} *start=NULL,*temp,*end=NULL;
void insert_beg(int x)
{
temp = new node;
if(temp==NULL) exit(0);
temp->data =x ;
temp->next=start;
if(start!=NULL)
start->prev = temp;
start=temp;
if(end==NULL)
end=start; //initially
}
is this a good approach ? since now we need not worry about next and prev being NULL , since they would by default be pointing to NULL … ?
how many of you can successfully implement a link list and carry out some trivia operation on it after watching the series? in the scale of 0-100 rate your knowledge on linked list based on the series
This is brilliant! Thanks! 🙂
You don’t talk about deallocating the nodes after we’re done with the list. Shouldn’t that be done explicitly since we allocated them in the heap?
you are amazing
please update more on doubly link list
Watching this video lectures should be made a part of the College curriculum.These videos helped me a lot during preparations for Exams.
can you please upload the same for circular,doubly circular linkists…