Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Create 3 large arrays to search, where the size will be variable up until it reaches your machines limit. They should contain the same

C++

Create 3 large arrays to search, where the size will be variable up until it reaches your machines limit.

They should contain the same information since we are going to compare 3 different algorithms.You are going to do operational/timing studies on them to determine their order. O(N), O(log(N)), and O(1) Search algorithms.Linear, Binary, Hash You should know which algorithms are what order,now you are going to prove it. Fill the 3 arrays with the same information but use random strings of say size 20 characters.Or use 1 array and 3 separate programs. You will perform searches on the arrays given strings that are in the array and those that are not. Make this about a 50-50 mix, or at least know what the mix is. a) Perform the linear search, record the time. If it does it very quickly you will need to adjust the size and the number of loops over the data till you get a few seconds. Then start increasing N. The object is to see how time increases as N increases. b) Perform the same task with the Binary Search.Obviously using Binary the data first has to be ordered. This is an O(N^2) to O(NlogN) function just on it's own but it only needs to be done once. Don't take this time into account. Yes, I know that's bad, but I just want to show specific algorithm differences not including the sort. c) Perform the same task with the Hash function.This is tricky since you have to develop the Hash function. Also, I want you to use chaining. This makes it easy since there are no collisions and you don't have to use algorithms for collisions, just use a linked list when a collision occurs. When done, plot the results of each algorithm as Time vs. N It should be easy to conclude the order of the algorithm.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+12 Distinguish between a hedger, a speculator and an arbitrageur,

Answered: 1 week ago

Question

3. What would you do now if you were Mel Fisher?

Answered: 1 week ago