Computer Science, asked by Sahilrihan8527, 1 year ago

Difference between linear search and sequential search

Answers

Answered by sjstgx
0
iske answer hamko nahu ayaeta to ham send nahi kr reha
Answered by Anonymous
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