Skip to main content

Section 8.8 Binary Search Lab 2

Subsection 8.8.1 Goals

Understand the Binary Search and apply its application to an array.

Subsection 8.8.2 Tasks

We will be performing a binary search on a BRIDGES array. The array is populated of size 30 and each element holds the value of its index making it a sorted array. Your job is to find the value 3, 25 and value 100 (doesn’t exist) using binary search.
Here is the starting file: BridgesArrayBinarySearch.java 1 
  1. Implement the Binary Search algorithm in the ’BinarySearch’ function. (10 points)
  2. For each iteration of the algorithm, color the low and high index green, the mid index ’orange’, and the found element ’red’ if it exists. (5 points)
  3. Visualize the array at every iteration to see how the algorithm progresses. (5 points)
  4. Add the link and images to the visualization that show the results of searching for 3, 25, and 100. (5 points)
To have multiple visualizations, change the integer value parameter on the line the bridges object is created. This assignment uses BRIDGES to visualize the array and the color attributes added. Every time you call the bridges visualize function, an additional visualization is added in a slideshow view. You can then play/step through each iteration of your algorithm to help learn and debug binary search. The scaffolded code comes with the main function and 1 static function. The static function is the binary search algorithm that you will implement. The other function is just a main function that you will not need to change except for your BRIDGES credentials and the value you are searching for.
You have attempted of activities on this page.
uncc.instructure.com/courses/16965/files/21470865?wrap=1