Review programming in a high-level language Implement linear search and binary search algorithms Evaluate performance...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Review programming in a high-level language • Implement linear search and binary search algorithms Evaluate performance of linear and binary search algorithms Instructions 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 sort method available (e.g., sort method in the Java Collection Framework). 4. You need to create multiple datasets to test the speed of your algorithms. Test the program for array sizes N= 16, 32, 64, 128, 256, 512, 1024, 2048, 220 Initialize the array with random numbers between the ranges 1 through N (Please note that we will be using these datasets for both linear search and binary search. Remember to sort the array before using binary search. These datasets will be our dataset that we will be searching our keys inside those datasets 5. Use a text file with 1,000 random numbers in the range 1 through 1000 as the search keys. You need to search all those 1000 numbers inside every dataset. 6. 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. In short you need to calculate the computation times as follows: Size of dataset Linear Search Binary Search 16 32 64 128 ww 2^20 Review programming in a high-level language • Implement linear search and binary search algorithms Evaluate performance of linear and binary search algorithms Instructions 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 sort method available (e.g., sort method in the Java Collection Framework). 4. You need to create multiple datasets to test the speed of your algorithms. Test the program for array sizes N= 16, 32, 64, 128, 256, 512, 1024, 2048, 220 Initialize the array with random numbers between the ranges 1 through N (Please note that we will be using these datasets for both linear search and binary search. Remember to sort the array before using binary search. These datasets will be our dataset that we will be searching our keys inside those datasets 5. Use a text file with 1,000 random numbers in the range 1 through 1000 as the search keys. You need to search all those 1000 numbers inside every dataset. 6. 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. In short you need to calculate the computation times as follows: Size of dataset Linear Search Binary Search 16 32 64 128 ww 2^20
Expert Answer:
Answer rating: 100% (QA)
Solution To complete the tasks youve outlined you can use a highlevel programming language like Java Heres a stepbystep guide on how to implement line... View the full answer
Related Book For
Auditing and Assurance services an integrated approach
ISBN: 978-0132575959
14th Edition
Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley
Posted Date:
Students also viewed these programming questions
-
A 75-year-old man has prostate cancer that has metastasized to bone. He is receiving hormonal therapy to slow progression of the neoplasm and codeine by mouth for pain when it is absolutely required,...
-
9.1 Exercise (JDK Source Code): Extract the source code of the class Math from the JDK source code ("$JAVA_HOME" "src.zip" "Math.java" under folder "java.lang"). Study how constants such as E and...
-
You used the percentage of alcohol to predict wine quality. The data are stored in VinhoVerde. From the results of that problem, b1 = 0.5624 and Sb1 = 0.1127. a. At the 0.05 level of significance, is...
-
Using mean-variance portfolio theory, prove that the efficient frontier becomes a straight line in the presence of a risk-free asset. [3] Consider two independent assets, Asset A and Asset B, with...
-
While exploring a cave, a spelunker starts at the entrance and moves the following distances. She goes 75.0 m north, 250 m east, 125 m at an angle 30.0 north of east, and 150 m south. Find the...
-
Niles and Cohen, CPAs earned $12,375,000 during 2016 using 75 employees. During 2017, the firm grew revenues to $15,400,000 and expanded the staff to 88 employees. a. Determine the revenue per...
-
Use a dot plot to display the data, which represent the weights (in kilograms) of 20 polar bears. Organize the data using the indicated type of graph. Describe any patterns. 426 428 436 545 510 386...
-
Financial information (in thousands of dollars) relating to three different companies follows. Instructions: 1. Compute the following ratios: (a) Return on sales (b) Asset turnover (c)...
-
In line with your duty as police officer, make a peace advocacy. make the proper advocacy message State your goals/objectives of your advocacy. Make a plan/outline on how are you going to promote...
-
A simply supported pretensioned beam has a span of 75 ft (22.9 m) and the cross section shown in Figure P3.1. It is subjected to a uniform gravitational live-load intensity W =1,200 plf (17.5 kN/m)...
-
The ABC Distributing ( ABC ) 2019 profit and lossstatement shown below. The depicted relationships are validwithin $14,000,000.00 to $65,000,000.00. What level of saleswould a new salesperson have to...
-
What is one disadvantage of Activity Based Costing? Explain in details.
-
=== 1. Let A = {1,2,3} and B = {4,5,6). Give an example of a relation R from A to B such that 1 is related to 5 but 2 is not related to 4.
-
How did the Soviets influence the political situation in Poland at the end of World War II?
-
The total liabilities of Hogan's Company on the balance sheet are $270,000; this amount is equal to three-fourths of the total assets. What is the amount of owners' equity?
-
What is one disadvantage of using a plant wide rate to allocate overhead? Explain in details.
-
12. The figure shows the relationship between enzyme and substrate molecule concentration on rate of reaction. Rate of reactions Substrate molecule
-
For the given transfer function: Vo(s) / Vi(s) = (s^2C^2R^2 + 1) / (s^2C^2R^2 + 4sCR + 1) Assumiing that 1/(CR) = 120 PI so write the matlab code to find the magnitude plot
-
The following are various activities an auditor does during audit planning. 1. Send an engagement letter to the client. 2. Tour the client's plant and offices. 3. Compare key ratios for the company...
-
What is meant by an imprest bank account for a branch operation? Explain the purpose of using this type of bank account.
-
Auditors are required to make inquiries of individuals in the company when gathering information to assess fraud risk. Identify those with whom the auditor must make inquiries.
-
A thin stainless steel disk of thickness \(b\) and outer radius \(r_{o}\) has been heat treated to a high, uniform initial temperature of \(T_{i}\). The disk is then placed upon a small stand and...
-
A plane wall of a furnace is fabricated from plain carbon steel \(\left(k=60 \mathrm{~W} / \mathrm{m} \cdot \mathrm{K}, ho=7850 \mathrm{~kg} / \mathrm{m}^{3}, c=430 ight.\) \(\mathrm{J} / \mathrm{kg}...
-
A steel sphere (AISI 1010), \(100 \mathrm{~mm}\) in diameter, is coated with a dielectric material layer of thickness \(2 \mathrm{~mm}\) and thermal conductivity \(0.04 \mathrm{~W} / \mathrm{m} \cdot...
Study smarter with the SolutionInn App