Programming Homework Help

Algorithm Jump Search C++ Question

 

Implement 4 searching algorithms. YES, YOU CAN USE CODE FROM THE INTERNET. The objective is not the implementation, it’s the second part 🙂 After you implement 4 searching algorithms, modify the code to calculate the run time to search for a set of 10 values in an array of size 100. Your output should be something like this:

Algorithm: Sequential Search

————————————-

Looking for value 66. It took 22 seconds 

Looking for value 23. It took 24 seconds

Looking for value 42. It took 27 seconds

…….

Average time it took to find the 10 values I searched for: 29 seconds.

Algorithm: Binary Search

——————————–

Looking for value 66. It took 12seconds

Looking for value 23. It took 11 seconds

Looking for value 42. It took 13 seconds

…….

Average time it took to find the 10 values I searched for: 12 seconds.

*Notes:

  • All search algorithms will use the same array (size 100).
  • Data can be filled in array randomly or you can hardcode it. Which ever is easier. Just make sure you do NOT have duplicate values in it).
  • The 10 elements you want to search for are the same 10 elements to be searched for in all 4 search algorithms

Again, you can use existing code from the internet to do the search, no need to write your own, your code should only be the part where you measure how much time it took to run each algorithm to search for the 10 values