Please send questions to st10@humboldt.edu .

#include <cassert>
using namespace std;

int count_seql(int array[], int left_index, int right_index,
                  int target, int& comps_so_far)
{
    assert(left_index >= 0);
    assert(right_index >= 0);

    for (int i = left_index; i <= right_index; i++)
    {
        // no matter what, at least one comparison will be made here
        //    (whether it succeeds or fails, it will be made)
        comps_so_far++;

        // comparison that is always attempted: is next element the one
        //    looking for?
        if (array[i] == target)
        {
            return i;
        }
    }

    // if get here --- element ISN'T in this range.
    return -1;    
}