Difference between linear search and sequential search
Answers
Answered by
0
iske answer hamko nahu ayaeta to ham send nahi kr reha
Answered by
0
Linear search and sequential search both are same.
code for linear search :-
#include<iostream.h>
void main ();
{
int are[5]= {2,5,7,9,1};
int i,num,POS=0;
cout <<"enter number to find";
cin>>num;
for(i=0;i<5,i++)
{
if(are[i]==num)
{
POS=1;
break;
}
}
if(POS==1)
{
cout<<"item position="<<POS ;
}
else
{
cout<<"not found";
}
}
Similar questions
Biology,
7 months ago
Math,
7 months ago
Math,
7 months ago
CBSE BOARD X,
1 year ago
Physics,
1 year ago