Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Due: Sunday, January 17, 2020 at 11:3pill Objectives: Review programming in a high-level language Implement linear search and binary search algorithms Evaluate the performance of

image text in transcribed
image text in transcribed
Due: Sunday, January 17, 2020 at 11:3pill Objectives: Review programming in a high-level language Implement linear search and binary search algorithms Evaluate the performance of linear and binary search Assignment: 1. Implement a method that will search a given array using the linear search algorithm. 2. Implement a method that will search a given array using a recursive binary search algorithm. 3. Write a driver program to test the methods implemented in questions 1-2. Note that you have to sort the input array before using the binary search algorithm, you can use any sorting method available 4. Test the program for array sizes N = 16, 32, 64, 128, 256, 512, 1024, 2048, ......, 2. Initialize the array with random numbers between the ranges 1 through N and use the same array for testing linear search and binary search. Remember to sort the array before using binary search. Use a text file with 1,000 random numbers in the range 1 through 2zoas the search keys. 5. Compare the execution time for linear search and binary search. Include the time taken for sorting with the binary search time (you have to sort only once for each array size). Use a table or plot to summarize the results and document your observations and explanations in the report. 4 50 34 40 22 54 94 3 94 38 8 95 0 36 54 54 81 30 24 98 12 25 43 0 52 52 188 22 83 70 96 57 89 53 13 64 74 18 37 86 73 76 15 193 69 77 81 29 78 14 45 67 10 41 60 63 74 16 75 75 36 49 68567 29 15 84 47 77 40 80 24 61 25 785 83 81 47 10 39 22 72 87 64 92 27 50 69 12 54 23 85 38 75 73 94

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

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

Students also viewed these Databases questions