Download the following files for the two program assignments:
Linear Search with Move to Front (LSMF) works as follows: each time you search, move the fish that's found one step closer to the front of the vector. For example, suppose your vector contains the following:
Fish: 6 4 2 5 1 7 3 10 9 8
and you search for fish id #7. After you find it, you move it one step toward the front by exchanging it with fish id #1; so the vector will now look like this:
Fish: 6 4 2 5 7 1 3 10 9 8
The function returns the location of where the fish was moved too if found, otherwise it returns -1.
Write the LSMF function that implements the above searching technique.
Write the support functions in lsmf.cppto show that your linear serach function actually works.
Enter fish ID to search for: 1000 The linear search found fish 1000 at location 499 taking 500 searches to do so The binary search found fish 1000 at location 499 taking 1 searches to do so Enter fish ID to search for: 99 The linear search did not find fish 99 after taking 1000 searches to do so The binary search did not find fish 99 after taking 10 searches to do so