Write a Brute Force Algorithm to find the two closest points in a set of n...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Brute Force Algorithm to find the two closest points in a set of n points (in the two-dimensional Cartesian plane). Brute-force algorithm computes the distance between every pair of distinct points and return the indexes of the points for which the distance is minimum. Distance between two points Pi (xi , yi) and P, (x, y): d(P, P) = V[(x-x)? + (v-y)*] This problem arises in a number of applications. For example, in air-traffic control, you may want to monitor planes that come too close together, since this may indicate a possible collision. Analyze your algorithm to find time efficiency (O). Write program in Java based on your algorithm. For the purpose of testing, generate 100 points using class Random and save these points in an array. Assume that x-coordinate ranges from 1 to 50 and y-coordinate also ranges from 1 to 50. Print the output, i.e., all 100 points with indices and the indices of the minimum distance points. Write a Brute Force Algorithm to find the two closest points in a set of n points (in the two-dimensional Cartesian plane). Brute-force algorithm computes the distance between every pair of distinct points and return the indexes of the points for which the distance is minimum. Distance between two points Pi (xi , yi) and P, (x, y): d(P, P) = V[(x-x)? + (v-y)*] This problem arises in a number of applications. For example, in air-traffic control, you may want to monitor planes that come too close together, since this may indicate a possible collision. Analyze your algorithm to find time efficiency (O). Write program in Java based on your algorithm. For the purpose of testing, generate 100 points using class Random and save these points in an array. Assume that x-coordinate ranges from 1 to 50 and y-coordinate also ranges from 1 to 50. Print the output, i.e., all 100 points with indices and the indices of the minimum distance points.
Expert Answer:
Answer rating: 100% (QA)
Approach Algorithm Algorithm Declare a class Point to represent x and y coord... View the full answer
Related Book For
Discrete Mathematics and Its Applications
ISBN: 978-0073383095
7th edition
Authors: Kenneth H. Rosen
Posted Date:
Students also viewed these programming questions
-
Give a pseudocode description of an algorithm to find the element with smallest key in a binary search tree. What is the running time of your method?
-
Use the Euclidean algorithm to find the greatest common divisor of 10,223 and 33,341.
-
Use the Euclidean algorithm to find the GCD. 35, 105
-
Hardie Lord, Helen Murvis's boss, is not convinced that Helen used the correct decision technique. Hardie believes that Helen should use a coefficient of realism of 0.75 in determining the best...
-
What determines whether a certain welding process can be used for work pieces in a horizontal, a vertical, or an upside-down position, or for all types of positions? Explain, giving appropriate...
-
What are auditors required to discuss with the board of directors? The audit committee?
-
Petitioner Salman was indicted for federal securities-fraud crimes for trading on inside information he received from a friend and relative-by-marriage, Michael Kara, who, in turn, had received the...
-
Finding Financial Information Refer to the financial statements of Urban Outfitters given in Appendix C at the end of this book. Required: For each question, answer it and indicate where you located...
-
Cash equivalents 8,000 Deposits 100,000 Mortgage loans 100,000 Shareholders' equity 8,000 Total assets 108,000 Total liabilities and equity 108,000 Interest income 5,000 Interest expense 1,000 Net...
-
Azim Electronics Inc. reported a cost of goods sold of $900,000 last year, when it produced and sold 25,000 units. The cost of goods sold was 25% materials, 65% direct labour, and 10% overhead. The...
-
Kevin recently turned 65 years of age. He moved to Canada 20 years earlier and has been working ever since and contributing maximum permissible amount to his CPP> During this period , he has saved...
-
Suppose that you have ten observations that have a mean of 7, a median of 6, and a standard deviation of 3. If you subtract 2 from the value of each observation, what are the new values of the a....
-
Lisa Cooper is an employee of a company that manufactures tear-proof tracksuits. Lisa is paid $60 per hour, and is the only person on staff who is trained to operate a piece of technology that is...
-
The CPI was 51 in 1800 and 25 in 1900. What was the annual percentage rate of change during this 100-year period?
-
Suppose you and your teammates have been tasked by a Japanese global manufacturing corporation to organize the recruitment of employees for a major vehicle manufacturing and assembly plant in the...
-
On a chilly Sunday morning, Shaz Granger bought 30 dozen doughnuts for $75, prepared 10 litres of hot coffee and went to a farm auction. There, she sold all the coffee and all but six dozen of the...
-
Given the following Student class, write an equals method to determine if two instances of Student are the same person. The equals method should base it's comparison on the student's M number. public...
-
Based on the scenario described below, generate all possible association rules with values for confidence, support (for dependent), and lift. Submit your solutions in a Word document (name it...
-
Use Algorithm 1 to find the transitive closures of these relations on {1, 2, 3, 4}. a) {(1, 2), (2,1), (2,3), (3,4), (4,1)} b) {(2, 1), (2,3), (3,1), (3,4), (4,1), (4, 3)} c) {(1, 2), (1,3), (1,4),...
-
Show that if n | m, where n and m are integers greater than 1, and if a b (mod m), where a and b are integers, then a b (mod n)?
-
Determine which transposition errors are detected by the USPS money order code.
-
In the section of his 2007 letter to the shareholders of Berkshire Hathaway titled Fanciful FiguresHow Public Companies Juice Earnings, Warren Buffett referred to the investment return assumption...
-
Based on 2012 revenues, the six largest providers of oilfield services are: 1. Schlumberger Ltd. (NYSE: SLB) Revenues: $42.1 billion Net income: $5.5 billion 2. Halliburton (NYSE: HAL) Revenues:...
-
On 21 September 2000, Intel Corporation (NASDAQ -GS: INTC)3 issued a press release containing information about its expected revenue growth for the third quarter of 2000. The announced growth fell...
Study smarter with the SolutionInn App