template<typename itor, typename item>
itor linear_search (itor begin, itor end, const item& key)
{
while (begin!=end) {
if (*begin==val)
return begin;
++begin;
}
return end;
} |
/* PLEASE UPVOTE (THANK YOU IN ADVANCE) IF YOU SATISFY WITH THE ANSWER IF ANY QUERY ASK ME IN COMMENT SECTION I WILL RE-SOLVE THE QUESTION FOR YOU */
7. Code a linear search. Given are two input iterators and a key to be located. Use only operators that are permit- ted on input iterators. For comparing keys, use only operatorReturn the iterator po...