Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Graham s algorithm for finding a convex hull ) Section 2 2 . 1 0 . 2 introduced Graham s algorithm for finding a convex

Grahams algorithm for finding a convex hull) Section 22.10.2
introduced Grahams algorithm for finding a convex hull for a set of points.
Assume that the Javas coordinate system is used for the points. Implement the
algorithm using the following method: /** Return the points that form a convex hull */
public static ArrayList getConvexHull(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.
}
}
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.

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

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

Recommended Textbook for

Icdt 88 2nd International Conference On Database Theory Bruges Belgium August 31 September 2 1988 Proceedings Lncs 326

Authors: Marc Gyssens ,Jan Paredaens ,Dirk Van Gucht

1st Edition

3540501711, 978-3540501718

More Books

Students also viewed these Databases questions