UrbanPro
true

Take BTech Tuition from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Data Structure with C

S
Sudipta Saha
19/11/2016 0 0

#include

#include

#include

#include

struct node

{

int data;

struct node *next;

}*start=NULL;

void create();

void display();

void search();

void main()

{

int ch;

clrscr();

while(1)

{

printf("choose... 1. create node \n 2.display \n 3. search \n 4. exit\n");

      scanf("%d",&ch);

switch(ch)

{

case 1:

create();

break;

case 2:

display();

break;

case 3:

search();

break;

case 4:

exit(0);

break;

default:

printf("invalid choice \n");

}

}

}

void create()

{

 

  struct node *p,*q;

p=(struct node *)malloc(sizeof(struct node));

 int  a;

 printf("press -1 to exit \n");

 scanf("%d",&a);

 while (a!=-1)

 {

  printf("\n Enter the data : ");

  scanf("%d",&p->data);

  p->next=NULL;

if(start==NULL)

  {

  start=p;

  return;

  }

    q=start;

    while(q->next!=NULL)

q=q->next;

 q->next=p;

}

  }

void display()

{

struct node *q;

 printf("The Linked List : n");

 q=start;

 while(q!=NULL)

   {

   printf("%d--->",q->data);

   q=q->next;

   }

}

 

 void search()

 {

   int item=0,f=0;

 struct node *q;

  printf (" enter the data to searche \n");

  scanf("%d",&item);

  q=start;

  while(q!=NULL)

  {

      if(q->data==item)

     {

      f=1;

      break;

      }

  q=q->next;

   }

   if (f==1)

       printf(" search successful \n");

       else

       printf(" searching not sucessful \n");

  }

0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You

Python - Solving Ordinary Differential Equations - Predator Prey Model aka Lotka Volterra Equations
This is an assignment in Python, I contributed to a numerical Python MOOC from George Washington University. The link to this assignment on github is here. The Lotka–Volterra equations, also...
S

Sri Vallabha Deevi

0 0
1

Viscometers
The measurement of viscosity is a large and complicated subject. The principles rely on the resistance to flow or the resistance to motion through a fluid. Many of these are covered in British Standards...

How to Clear Engineering Mathematics
Clearing Maths is not a great deal. All you need to follow is just a small key. Take last three years question papers and start working out the sums. Do not leave the choices. work out all sums. thats...

Internet of Things, Social Media Becoming Part of E-Discovery Landscape
The days when e-discovery consisted of handing over copies of e-mails to address Freedom of Information Act (FOIA) requests, compliance regulations or other legal obligations are over. Now, it's just as...

Design Pattern
Prototype Design Pattern: Ø Prototype pattern refers to creating duplicate object while keeping performance in mind. Ø This pattern involves implementing a prototype interface which tells...
X

Looking for BTech Tuition Classes?

The best tutors for BTech Tuition Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Take BTech Tuition with the Best Tutors

The best Tutors for BTech Tuition Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more