Question
Binary Search vs. Brute Force Search Algorithms for Finding a Local Minimum in a TwoDimensional Array In this project, you will implement the binary search-based
Binary Search vs. Brute Force Search Algorithms for Finding a Local Minimum in a TwoDimensional Array
In this project, you will implement the binary search-based (n) algorithm to determine the local minimum in an 'n' x 'n' two-dimensional array (as discussed in Module 2) and compare its run-time performance with that of a brute force (n2 ) algorithm that searches for the local minimum element by element until one is found.
Note that both the binary search and the brute force search algorithms should stop once a local minimum is found.
You should create random two-dimensional arrays (with numRows = numCols) with unique elements in the range [1... numRows * numCols] for the following values of numRows (numCols) and determine the average execution time of the binary search and the brute force search algorithms by running 100 trials for each of the numRows (numCols) values. Determine the running times in nano seconds or milli seconds, as appropriate.
numRows (numCols) values: 4, 6, 8, 10, 15, 20, 25, 30, 35, 40, 50, 75, 100, 150, 200, 250, 300, 350
Plot the results with numRows in X-axis and the average execution times (in nanoseconds or milliseconds) of the binary search and the brute force search algorithms in the Y-axis.
Submission Submit a hardcopy of your codes for the binary search and brute force search algorithms, the Excel plots of the numRows vs. average execution times of the two algorithms as well as your interpretation of the results.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started