Indent code and insert comments to document your program. 

Program must be implemented and run

 

The following sequential search algorithm is non-recursive.  Write and implement a recursive version of this sequential search algorithm.

int seqSearch(const int list[], int listLength, int searchItem)

{

    int loc;

    bool found = false;

    loc = 0;

    while( loc <listLength && !found)

    {

      if(list[loc] == searchItem)

         found = true;

                 else

                                loc++;

 

                 if( found )

                                return loc;

                 else

                                return -1;

    }

}

 

 

 

    • 11 years ago
    C++ program
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      sequentialsearch.zip