Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

City mpg Classification Driveline Engine Type Fuel Type Height Highway mpg Horsepower Hybrid ID Length Make Model Year Number of Forward Gears Torque Transmission Width

City mpg Classification Driveline Engine Type Fuel Type Height Highway mpg Horsepower Hybrid ID Length Make Model Year Number of Forward Gears Torque Transmission Width Year
18 Automatic transmission All-wheel drive Audi 3.2L 6 cylinder 250hp 236ft-lbs Gasoline 140 25 250 FALSE 2009 Audi A3 3.2 143 Audi 2009 Audi A3 6 236 6 Speed Automatic Select Shift 202 2009
22 Automatic transmission Front-wheel drive Audi 2.0L 4 cylinder 200 hp 207 ft-lbs Turbo Gasoline 140 28 200 FALSE 2009 Audi A3 2.0 T AT 143 Audi 2009 Audi A3 6 207 6 Speed Automatic Select Shift 202 2009
21 Manual transmission Front-wheel drive Audi 2.0L 4 cylinder 200 hp 207 ft-lbs Turbo Gasoline 140 30 200 FALSE 2009 Audi A3 2.0 T 143 Audi 2009 Audi A3 6 207 6 Speed Manual 202 2009
21 Automatic transmission All-wheel drive Audi 2.0L 4 cylinder 200 hp 207 ft-lbs Turbo Gasoline 140 28 200 FALSE 2009 Audi A3 2.0 T Quattro 143 Audi 2009 Audi A3 6 207 6 Speed Automatic Select Shift 202 2009
21 Automatic transmission All-wheel drive Audi 2.0L 4 cylinder 200 hp 207 ft-lbs Turbo Gasoline 140 28 200 FALSE 2009 Audi A3 2.0 T Quattro 143 Audi 2009 Audi A3 6 207 6 Speed Automatic Select Shift 202 2009

First Task:

The idea of this project is to create a text-based application with the following options:

  1. List all cars. This option will read from the file and when the user selects this option, the program will list all the cars in the file.

  1. Find via Linear search. This option will allow the user to type a model of the car (ID field in the dataset) and it should print out the information about the car searched, the amount of time it took to find the car using linear search. For this option, create a class called SearchMethods and implement the method :

public static > int linearSearch(T[] data, int min, int max, T target)

  1. Find via Binary search. This option will allow the user to type a model of the car (ID field in the dataset) and it should print out the information about the car searched, and the amount of time it took to find the car using binary search. For this option create, a class called SearchMethods and implement the method:

public static >

int binarySearch(T[] data, int min, int max, T target)

in both 2 and 3 the binary and linear search methods return the position in the array where the elements are found.

Remember: To apply binary Search you must sort the array. Measure the time to execute binary search only when calling binary search, not on the sorting part of it.

  1. Option to quit the program.

Second Task:

Time Complexity: Build a table and record the time complexity taken by linear and binary search to look for an element with the following array sizes: 10, 50, 100, 200, 500, 700, 1000. Compare the performance of both algorithms highlighting the time complexity for both algorithms when run on small input size and when run on large input size.

To accomplish this, load a list with the file data and then create a program that selects at random X amount of elements from the original list (where X is a value that the user selects) and place them in an array, then select at random an element in the original list to search in the sampled array using both algorithms. Measure the time it takes for both algorithms on an array of a given input size.

For this part just create a class called Task2Exercise in your project, reuse any code you did for the first part.

Special Note: The excel sheet table is given for your convenience. You can just copy and paste the above data. The name of the spreadsheet would be "car.csv". Please complete it in Intelli J and make the code as simple as possible. Please provide note for understanding. Thank you.

Additional Info: There is a slide bar below the question which can be used to go right and view the rest of the question that is not visible all at once.

Answer to the comment: It is a small portion of a large task. I need help understanding so that I can complete the entire task.

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_2

Step: 3

blur-text-image_3

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

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

Students also viewed these Databases questions