"Some of the brightest minds in the country can be found on the last benches of the classroom" Dr. A. P. J. Abdul Kalam
Saturday, 8 December 2018
Thursday, 6 December 2018
Thursday, 15 November 2018
WRITE DOWN A C PROGRAM TO INSERT IN BEGINNING & END, DELETE A NODE IN BEGINNING & END, TRAVERSE FOR THE CIRCULAR - SINGLY LINKED LIST (C-SLL) AND ALSO MODIFY A SPECIFIED NODE FOR THE CIRCULAR - SINGLY LINKED LIST (C-SLL) USING GLOBAL START VARIABLE & CALL BY REFERENCE & BY USING THE SWITCH CASE.
WRITE DOWN A C PROGRAM TO INSERT IN BEGINNING & END, DELETE A NODE IN BEGINNING & END, TRAVERSE FOR THE CIRCULAR - SINGLY LINKED LIST (C-SLL) AND ALSO MODIFY A SPECIFIED NODE FOR THE CIRCULAR - SINGLY LINKED LIST (C-SLL) USING GLOBAL START VARIABLE & CALL BY REFERENCE & BY USING THE SWITCH CASE.
- #include <stdio.h>
- #include <stdlib.h>
- #include <malloc.h>
- struct node
- {
- int data;
- struct node *next;
- };
- struct node *start=NULL;
- void create_nodebegining(int);
- void create_nodeend(int);
- void delete_nodebegining();
- void delete_nodeend();
- void modify(int,int);
- void traverse();
- int main()
- {
- int data,i,n,ch,data1;
- printf("\n Enter The Value of data to be Entered:\n");
- scanf("%d",&n);
- for(i=0;i<n;i++)
- {
- printf("\n Enter The Value Should be Enter In Data of Node:\n");
- scanf("%d",&data);
- create_nodeend(data);
- }
- printf("\n Please Enter Your Choise \n ");
- printf("\n Press 1 for Insert in Beginning \n Press 2 for Insert in end \n Press 3 Delete in Beginning \n Press 4 for delete in end \n Press 5 for modify \n press 6 for traverse \n");
- scanf("%d",&ch);
- switch(ch)
- {
- case 1:
- printf("\n Enter The Value For Node Data:\n");
- scanf("%d",&data);
- create_nodebegining(data);
- break;
- case 2:
- printf("\n Enter The Value For Node Data:\n");
- scanf("%d",&data);
- create_nodeend(data);
- break;
- case 3:
- delete_nodebegining();
- break;
- case 4:
- delete_nodeend();
- break;
- case 5:
- printf("\n Enter The Data To be Modified:\n");
- scanf("%d",&data1);
- printf("\n Enter The Data Modified:\n");
- scanf("%d",&data);
- modify(data1,data);
- break;
- case 6:
- traverse();
- break;
- }
- traverse();
- }
- void create_nodeend(int x)
- {
- struct node *t,*t1;
- t=(struct node*)malloc(sizeof(struct node));
- t->data=x;
- t->next=NULL;
- if(start==NULL)
- {
- start=t;
- t->next=start;
- }
- else
- {
- t1=start;
- while(t1->next!=start)
- {
- t1=t1->next;
- }
- t->next=start;
- t1->next=t;
- }
- }
- void create_nodebegining(int x)
- {
- struct node *t,*t1;
- t=(struct node*)malloc(sizeof(struct node));
- t1=start;
- t->data=x;
- t->next=t1;
- while(t1->next!=start)
- {
- t1=t1->next;
- }
- start=t;
- t1->next=start;
- traverse();
- }
- void delete_nodeend()
- {
- struct node *t,*t1;
- t=start;
- while(t->next!=start)
- {
- t1=t;
- t=t->next;
- }
- free(t);
- t1->next=start;
- traverse();
- }
- void delete_nodebegining()
- {
- struct node *t,*t1=start;
- t=start->next;
- while(t1->next!=start)
- {
- t1=t1->next;
- }
- free(start);
- start=t;
- t1->next=start;
- traverse();
- }
- void modify(int x,int y)
- {
- struct node *t;
- t=start;
- while(t->data!=x)
- {
- t=t->next;
- }
- t->data=y;
- traverse();
- }
- void traverse()
- {
- struct node *t;
- t=start;
- while(t->next!=start)
- {
- printf("\n %d",t->data);
- t=t->next;
- }
- printf("\n %d\n\n",t->data);
- }
WRITE DOWN A C PROGRAM TO INSERT IN BEGINNING & END, DELETE A NODE IN BEGINNING & END, TRAVERSE FOR THE CIRCULAR - DOUBLY LINKED LIST (C-DLL) AND ALSO MODIFY A SPECIFIED NODE FOR THE CIRCULAR - DOUBLY LINKED LIST USING GLOBAL START VARIABLE & CALL BY REFERENCE & BY USING THE SWITCH CASE.
WRITE DOWN A C PROGRAM TO INSERT IN BEGINNING & END, DELETE A NODE IN BEGINNING & END, TRAVERSE FOR THE Circular - DOUBLY LINKED LIST (C-DLL) AND ALSO MODIFY A SPECIFIED NODE FOR THE CIRCULAR - DOUBLY LINKED LIST USING GLOBAL START VARIABLE & CALL BY REFERENCE & BY USING THE SWITCH CASE.
- #include <stdio.h>
- #include <stdlib.h>
- #include <malloc.h>
- struct node
- {
- struct node *prev;
- int data;
- struct node *next;
- };
- struct node *start=NULL;
- void create_nodebegining(int);
- void create_nodeend(int);
- void delete_nodebegining();
- void delete_nodeend();
- void modify(int,int);
- void traverse();
- int main()
- {
- int data,i,n,ch,data1;
- printf("\n Enter The Value of data to be Entered:\n");
- scanf("%d",&n);
- for(i=0;i<n;i++)
- {
- printf("\n Enter The Value Should be Enter In Data of Node:\n");
- scanf("%d",&data);
- create_nodeend(data);
- }
- printf("\n Please Enter Your Choise \n ");
- printf("\n Press 1 for Insert in Beginning \n Press 2 for Insert in end \n Press 3 Delete in Beginning \n Press 4 for delete in end \n Press 5 for modify \n press 6 for traverse \n");
- scanf("%d",&ch);
- switch(ch)
- {
- case 1:
- printf("\n Enter The Value For Node Data:\n");
- scanf("%d",&data);
- create_nodebegining(data);
- break;
- case 2:
- printf("\n Enter The Value For Node Data:\n");
- scanf("%d",&data);
- create_nodeend(data);
- break;
- case 3:
- delete_nodebegining();
- break;
- case 4:
- delete_nodeend();
- break;
- case 5:
- printf("\n Enter The Data To be Modified:\n");
- scanf("%d",&data1);
- printf("\n Enter The Data Modified:\n");
- scanf("%d",&data);
- modify(data1,data);
- break;
- case 6:
- traverse();
- break;
- }
- traverse();
- }
- void create_nodeend(int x)
- {
- struct node *t,*t1;
- t=(struct node*)malloc(sizeof(struct node));
- t->prev=NULL;
- t->data=x;
- t->next=NULL;
- if(start==NULL)
- {
- start=t;
- t->next=start;
- start->prev=t;
- }
- else
- {
- t1=start;
- while(t1->next!=start)
- {
- t1=t1->next;
- }
- t->next=start;
- t->prev=t1;
- t1->next=t;
- start->prev=t;
- }
- }
- void create_nodebegining(int x)
- {
- struct node *t,*t1;
- t1=start;
- t=(struct node*)malloc(sizeof(struct node));
- t->prev=NULL;
- t->data=x;
- t->next=NULL;
- while(t1->next!=start)
- {
- t1=t1->next;
- }
- start->prev=t;
- t->next=start;
- start=t;
- t1->next=start;
- t->prev=t1;
- traverse();
- }
- void delete_nodeend()
- {
- struct node *t,*t1;
- t=start;
- while(t->next!=start)
- {
- t1=t;
- t=t->next;
- }
- free(t);
- t1->next=start;
- traverse();
- }
- void delete_nodebegining()
- {
- struct node *t,*t1;
- t1=start;t=start;
- while(t1->next!=start)
- {
- t1=t1->next;
- }
- free(start);
- start=t->next;
- start->prev=t1;
- t1->next=start;
- traverse();
- }
- void modify(int x,int y)
- {
- struct node *t;
- t=start;
- while(t->data!=x)
- {
- t=t->next;
- }
- t->data=y;
- traverse();
- }
- void traverse()
- {
- struct node *t;
- t=start;
- while(t->next!=start)
- {
- printf("\n %d",t->data);
- t=t->next;
- }
- printf("\n %d\n\n",t->data);
- }
Subscribe to:
Posts (Atom)
Semester Question Papers for Computer Science and Engineering Students 2020 - 2021 | Computer Science and Engineering | MAKAUT | WBUT | Maulana Abul Kalam Azad University of Technology
Computer Science and Engineering 3rd Semester Question Papers Download Question Papers o...
-
W.B.C.H.S.E 11(XI) HIGHER SECONDARY EXAM 2016 EXAM QUESTIONS PDF W.B.C.H.S.E 11(XI) 2016 (2015-2016) EXAM QUESTIONS PDF (*PHYSICS*,*MA...
-
Physics Practical Copy 1 & Copy 2 Class 11 (XI) PDF Download Physics Practical Copy 1 & Copy 2 Class 11 (XI) West Bengal Cou...
-
Questions Papers All Subjects of 3rd Semester The year 2015, 2016,2017 Diploma (Polytechnic) Computer Science & Technology ...