Question: Data structure ( C++ ). I want to ask If my answer for this question is correct or not ? 5. Write an algorithm of
Data structure ( C++ ).
I want to ask If my answer for this question is correct or not ?
5. Write an algorithm of consecutive searching of elements in an array (Searching of one element equal to the given element (by barrier method);
i=0;
A[n]=X;
while (A[i]!=X)
i++;
if(i==n)
cout<<"NO";
else
cout<<"YES "
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
