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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!