Menu
http://www.gowrikumar.com
Menu
Initialize InsertBegin InsertEnd Insert Find Delete
Menu
http://www.gowrikumar.com
Menu
Initialize
http://www.gowrikumar.com
Menu
http://www.gowrikumar.com
Menu
head X List Initialize() { Node* temp; main() { temp = (Node*)calloc(1,sizeof(Node)); return temp;
List head;
head = Initialize(); }
January 26, 2014
http://www.gowrikumar.com
Menu
InsertBegin
http://www.gowrikumar.com
Menu 1 head X 10 8 4 6 3 2 5
http://www.gowrikumar.com
Menu 1 head X void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; }
January 26, 2014 http://www.gowrikumar.com
10
Menu 1 head X void InsertBegin(List head,int d) 1 { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; }
January 26, 2014 http://www.gowrikumar.com
10
Menu 1 head X 1 10 8 4 6 3 2 5
http://www.gowrikumar.com
Menu 1 head X void InsertBegin(List head,int d) 1 { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; }
January 26, 2014 http://www.gowrikumar.com
10
Menu 1 head X void InsertBegin(List head,int d) 1 { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; }
January 26, 2014 http://www.gowrikumar.com
10
Menu 1 head X void InsertBegin(List head,int d) 1 { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; head->next = temp; temp->next = head->next; }
January 26, 2014 http://www.gowrikumar.com
10
Menu 1 head X 1 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; }
January 26, 2014 http://www.gowrikumar.com
10
Menu 1 head X 1 void InsertBegin(List head,int d) 10 { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; }
January 26, 2014 http://www.gowrikumar.com
10
Menu 1 head X 1 void InsertBegin(List head,int d) 10 { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; head->next = temp; temp->next = head->next; }
January 26, 2014 http://www.gowrikumar.com
10
Menu
InsertEnd
http://www.gowrikumar.com
Menu 1 head X tail void InsertEnd(List head,int d) { Node *tail,*temp; tail = head; ........ ........ } 10 1 10 8 4 6 3 2 5
http://www.gowrikumar.com
Menu 1 head X 10 tail void InsertEnd(List head,int d) { Node *tail,*temp; tail = head; while(tail->next != NULL) tail = tail->next; ........ ........ }
January 26, 2014 http://www.gowrikumar.com
10
Menu 1 head X 10 1 tail void InsertEnd(List head,int d) { Node *tail,*temp; tail = head; while(tail->next != NULL) tail = tail->next; ........ ........ }
January 26, 2014 http://www.gowrikumar.com
10
http://www.gowrikumar.com
Menu
Insert
http://www.gowrikumar.com
Menu 1 head X 10 1 8 10 8 4 6 3 2 5
http://www.gowrikumar.com
Menu 1 head X 10 1 8 10 8 4 6 3 2 5
http://www.gowrikumar.com
Menu 1 head X 10 1 4 8 10 8 4 6 3 2 5
http://www.gowrikumar.com
Menu
Find
http://www.gowrikumar.com
Menu 1 head X 10 1 4 8 10 8 4 6 3 2 5
void Find(List l,Node* p,int d) { Node *temp; temp = l; while(temp->next != NULL) { if(temp->next->data == d) return temp; temp = temp->next; } return NULL; }
January 26, 2014 http://www.gowrikumar.com
void Find(List l,Node* p,int d) { Node *temp; temp = l; while(temp->next != NULL) { if(temp->next->data == d) return temp; temp = temp->next; } return NULL; }
January 26, 2014 http://www.gowrikumar.com
Menu
Delete
http://www.gowrikumar.com
Menu 1 head X 10 1 4 8 10 8 4 6 3 2 5
void Delete(List l,Node* p,int d) { Node *temp,*del; temp = Find(l,d); if(temp != NULL) { del = temp->next; temp->next = del->next; free(del); } }
January 26, 2014 http://www.gowrikumar.com
temp 10
void Delete(List l,Node* p,int d) { Node *temp,*del; temp = Find(l,d); if(temp != NULL) { del = temp->next; temp->next = del->next; free(del); } }
January 26, 2014 http://www.gowrikumar.com
Menu 10 head X 10 4 8 8 4 6 3 2 5
http://www.gowrikumar.com
InsertBegin(l,1);
InsertBegin(l,10); InsertEnd(l,8); temp = Find(l,8); Insert(l,temp,4); Delete(l,1); }
January 26, 2014 http://www.gowrikumar.com
Menu
The End
http://www.gowrikumar.com