Section 22.10.2 introduced Graham?s algorithm for finding a convex hull for a set of points. Assume that
Question:
Section 22.10.2 introduced Graham?s algorithm for finding a convex hull for a set of points. Assume that the Java?s coordinate system is used for the points. Implement the algorithm using the following method:
Write a test program that prompts the user to enter the set size and the points and displays the points that form a convex hull. Here is a sample run:
Transcribed Image Text:
/** Return the points that form a convex hull */ public static ArrayList
/** Return the points that form a convex hull */ public static ArrayList getConvexHul1 (double[][] s) MyPoint is a static inner class defined as follows : private static class MyPoint implements Comparable { double x, y; MyPoint rightMostLowestPoint; MyPoint (double x, double y) { this.x = x; this.y = y; public void setRightMostLowestPoint(MyPoint p) { rightMostLowestPoint = p; @Override public int compareTo(MyPoint o) { // Implement it to compare this point with point o // angularly along the x-axis with rightMostLowestPoint // as the center, as shown in Figure 22.10b. By implementing // the Comparable interface, you can use the Array.sort // method to sort the points to simplify coding. } How many points are in the set? 6 -Enter Enter Enter 6 points: 1 2.4 2.5 2 1.5 34.5 5.5 6 6 2.4 5.5 9 The convex hull is (1.5, 34.5) (5.5, 9.0) (6.0, 2.4) (2.5, 2.0) (1.0, 2.4)
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 81% (16 reviews)
Program Plan Create class convexHullGraham In convexHullGraham create methods getConvexHull which returns pointStack placeFirstPoint which places the ...View the full answer
Answered By
Aysha Ali
my name is ayesha ali. i have done my matriculation in science topics with a+ . then i got admission in the field of computer science and technology in punjab college, lahore. i have passed my final examination of college with a+ also. after that, i got admission in the biggest university of pakistan which is university of the punjab. i am studying business and information technology in my university. i always stand first in my class. i am very brilliant client. my experts always appreciate my work. my projects are very popular in my university because i always complete my work with extreme devotion. i have a great knowledge about all major science topics. science topics always remain my favorite topics. i am also a home expert. i teach many clients at my home ranging from pre-school level to university level. my clients always show excellent result. i am expert in writing essays, reports, speeches, researches and all type of projects. i also have a vast knowledge about business, marketing, cost accounting and finance. i am also expert in making presentations on powerpoint and microsoft word. if you need any sort of help in any topic, please dont hesitate to consult with me. i will provide you the best work at a very reasonable price. i am quality oriented and i have 5 year experience in the following field.
matriculation in science topics; inter in computer science; bachelors in business and information technology
_embed src=http://www.clocklink.com/clocks/0018-orange.swf?timezone=usa_albany& width=200 height=200 wmode=transparent type=application/x-shockwave-flash_
4.40+
11+ Reviews
14+ Question Solved
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Question Posted:
Students also viewed these Computer science questions
-
Programming Exercise finds a convex hull for a set of points entered from the console. Write a program that enables the user to add/remove points by clicking the left/right mouse button, and displays...
-
Section 22.10.1 introduced the gift-wrapping algorithm for finding a convex hull for a set of points. Assume that the Java?s coordinate system is used for the points. Implement the algorithm using...
-
The text introduced Prims algorithm for finding a minimum spanning tree. Kruskals algorithm is another well-known algorithm for finding a minimum spanning tree. The algorithm repeatedly finds a...
-
Dickletton Attorneys' policy is to bank all receipts in its Trust bank account and at the end of each month the bookkeeper transfers the relevant funds due to Dickletton Attorneys from the trust to...
-
Show that the representation in equation (6) is unique, that is, if x = 1x1 + a2x2 +..........+ anxn and also if x = 1x1 + 2x2 +............+ nxn then i = i for all i.
-
According to the Bureau of Labor Statistics, the average workweek for an adult in the United States in February 2013 was 34.5 hours. Assume the population standard deviation for the number of hours...
-
Consider the four types of charismatic leader identified by Styrer (1998): hero, father figure, missionary and saviour. Discuss the ways in which the types of leader are similar or different. LO5
-
The Hyperion Company has an authorized capital stock of one thousand shares with a par value of $100 per share, of which nine hundred shares, all fully paid, were outstanding. Having an ample...
-
ending 4. What income statement format does Starbucks use? Explain. 5. Compute Starbucks's gross profit percentage for the year ending September 29, 2013, and the year ending September 30, 2012. Did...
-
a. Assume that you are called in as a forensic accountant to advise Geox. How would you suggest evaluating the contemplated open-source shopping cart systems? b. How does the fact that the systems...
-
Write a program that obtains the execution time for finding all the prime numbers less than 8,000,000, 10,000,000, 12,000,000, 14,000,000, 16,000,000, and 18,000,000 using the algorithms in Listings...
-
Write a program that obtains the execution time for finding the GCD of every two consecutive Fibonacci numbers from the index 40 to index 45 using the algorithms in Listings 22.3 and 22.4. Your...
-
What is a firms capital structure, and why is it important?
-
In a fixed time and budget project, the customer wants the development of a core component to be based on agile practices, as the final scope of the requirement has not yet been fully developed. The...
-
1. Ace Pizzeria, a manufacturer of frozen pizzas, computes its predetermined overhead rate annually based on machine hours. At the beginning of the year, the company estimated that 165,000 machine...
-
From a group of 13 boys and 9 girls, a committee of 5 students is chosen at random. a. The probability that all 5 members on the committee will be girls is (Type an integer or a simplified fraction.)...
-
On December 1, 2020, Cream Ale Ltd. receives $1,800 in advance for an agreement to brew beer during the months of December, January, and February. What is the revenue recognized under accrual...
-
A survey shows that of 100 nurses, 75 play at least soccer, 95 play at least softball, and 50 play both soccer and softball. Is this possible? Step one: Understand the problem and organize the given...
-
Many manufacturing companies use statistical techniques to ensure that the products they make meet standards. One common way to do this is to take a random sample of products at regular intervals...
-
Give the structural formulas of the alkenes that, on ozonolysis, give: a. (CH3)2C=O and CH2=O b. Only (CH3CH2)2C=O c. CH3CH=O and CH3CH2CH=O d. O=CHCH2CH2CH2CH=O
-
What is the transmission time of a packet sent by a station if the length of the packet is 1 million bytes and the bandwidth of the channel is 200 Kbps?
-
We have a channel with 4 KHz bandwidth. If we want to send data at 100 Kbps, what is the minimum SNR dB ? What is the SNR?
-
We need to upgrade a channel to a higher bandwidth. Answer the following questions: a. How is the rate improved if we double the bandwidth? b. How is the rate improved if we double the SNR?
-
Example 3-1 In 20--, the annual salaries paid each of the officers of Abrew, Inc., follow. The officers are paid semimonthly on the 15th and the last day of the month. Compute the FICA taxes to be...
-
Jaybird Company operates in a highly competitive market where the market price for its product is $120 per unit. Jaybird desires a 30% profit per unit. Jaybird expects to sell 5,000 units. Additional...
-
2.2. You have a stock in the three-period binomial model such that So = 4, S.(H) = 8, S (T) = 2, and r=0.25. (c) Work out the value tree for a forward contract with delivery time 3 and delivery price...
Study smarter with the SolutionInn App