Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help on Python coding. Using import collections import time import sys from typing import List from typing import Tuple to finish the rest of

Need help on Python coding.

Using

import collections import time import sys from typing import List from typing import Tuple 

to finish the rest of the code. required to read the document from the computer

image text in transcribedimage text in transcribed

2 Implementation Write a program, merchants.py, that demonstrates the performance differences between using Quickselect and Quicksort to solve the problem of finding the median location for the new merchant 2.1 Command Line The program is run on the command line as If the number of command line arguments is incorrect, display a u If slow is specified, use Quicksort to find the merchant at the median location, otherwise $ python3 merchants.py [slowlfast] input-file sage message and exit Usage: python3 merchants.py [slowlfast] input-file assume fast is specified and use Quickselect Assume the input file exists, and it contains at least one merchant. The in-lab activity downloaded a series of test files that to use 2.2 Program Output When the program runs, it will produce 5 lines of output The search type that was specified on the command line: The total number of merchants in the input file: The time it took to perform the search, in seconds The merchant at the median: The sum of the distances from the optimal location, to all the other merchant locations Search type: [slowlfast] Number of merchants: # Elapsed time: # seconds Optimal store location : Merchant (name="XXX', location=#) Sum of distances: # 2 Implementation Write a program, merchants.py, that demonstrates the performance differences between using Quickselect and Quicksort to solve the problem of finding the median location for the new merchant 2.1 Command Line The program is run on the command line as If the number of command line arguments is incorrect, display a u If slow is specified, use Quicksort to find the merchant at the median location, otherwise $ python3 merchants.py [slowlfast] input-file sage message and exit Usage: python3 merchants.py [slowlfast] input-file assume fast is specified and use Quickselect Assume the input file exists, and it contains at least one merchant. The in-lab activity downloaded a series of test files that to use 2.2 Program Output When the program runs, it will produce 5 lines of output The search type that was specified on the command line: The total number of merchants in the input file: The time it took to perform the search, in seconds The merchant at the median: The sum of the distances from the optimal location, to all the other merchant locations Search type: [slowlfast] Number of merchants: # Elapsed time: # seconds Optimal store location : Merchant (name="XXX', location=#) Sum of distances: #

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions