#define size 10
void sort ( int[]);
void seqsearch (int[], int);
void binarysearch (int [], int);
void main ()
{
int list[] = {10,19,18,17,15,14,13,12,11};
int target;
int i;
printf("\nEnter the value to search : ");
scanf("%d",&target);
seqsearch(list,target);
sort (list);
printf("\n\t\tSORTED LIST");
for (i=0; i
}
void seqsearch(int list[], int t)
{
int i=0;
while(i
if( i
else
printf("\nTarget not in the list\n");
}
void sort(int list[])
{
int i,j,temp;
for(i=0; i
{
temp=list[i];
list[i]=list[j];
list[j]=temp;
}
}
No comments:
Post a Comment