Question
In java or C++ In this lab we will creating twos arrays of Generic objects, searching through those arrays using BINARY and SEQUENTIAL sorts, calculate
In this lab we will creating twos arrays of Generic objects, searching through those arrays using BINARY and SEQUENTIAL sorts, calculate the run-time of each method, and determine the BIG O, OMEGA and THETA notation.
In our object we should have some way to compare elements to determine if one element is LESS THAN, GREATER THAN, and EQUAL TO. After this Generic Class is defined with a method that allows for comparison is completed, then you will create 2 arrays, one which is unsorted, the other which is sorted from the smallest to the largest element.
Thanks!
You will write one method that performs the SEQUENTIAL SEARCH for an individual element on an array. This method should be named SequentialSearch, and should take in the parameters of an Generic array and a Generic Element to be searched for. If the element exist in the array return its index, if the element doesn't exist return -1.
You will write one method that performs the BINARY SEARCH for an individual element on an array. This method should be named BinarySearch, and should take in the parameters of an Generic array and a Generic Element to be searched for. If the element exist in the array return its index, if the element doesn't exist return -1.
You will also count the number of operations that is performed in each method and will calculate the RUN-TIME of each method, as well as calculating the BIG O, OMEGA and THETA notation of each method. This information should be written in a comment block before each method ( you may count the number of operations on each line if you want ).
You are required to write self commenting code for this Lab, refer to the Google Style Sheet if you haven't become familiar with it.
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