Graham Scan icon

1.0 by Tanishq Saluja


Apr 14, 2018

About Graham Scan

Graham's scan is a method of finding the convex hull of a finite set of points

The first step in this algorithm is to find the point with the lowest y-coordinate. If the lowest y-coordinate exists in more than one point in the set, the point with the lowest x-coordinate out of the candidates should be chosen. Call this point P. This step takes O(n), where n is the number of points in question.

Next, the set of points must be sorted in increasing order of the angle they and the point P make with the x-axis. Any general-purpose sorting algorithm is appropriate for this, for example heapsort (which is O(n log n)).

The algorithm proceeds by considering each of the points in the sorted array in sequence. For each point, it is first determined whether traveling from the two points immediately preceding this point constitutes making a left turn or a right turn. If a right turn, the second-to-last point is not part of the convex hull, and lies 'inside' it.

Sorting the points has time complexity O(n log n). While it may seem that the time complexity of the loop is O(n2), because for each point it goes back to check if any of the previous points make a "right turn", it is actually O(n), because each point is considered at most twice in some sense. Each point can appear only once as a point ( x 2 , y 2 ) in a "left turn" (because the algorithm advances to the next point ( x 3 , y 3 )after that), and as a point ( x 2 , y 2 ) in a "right turn" (because the point ( x 2 , y 2 ) { is removed). The overall time complexity is therefore O(n log n), since the time to sort dominates the time to actually compute the convex hull.

What's New in the Latest Version 1.0

Last updated on Apr 14, 2018

Minor bug fixes and improvements. Install or update to the newest version to check it out!

Translation Loading...

Additional APP Information

Latest Version

Request Graham Scan Update 1.0

Requires Android

4.2 and up

Show More

Graham Scan Screenshots

Comment Loading...
Searching...
Subscribe to APKPure
Be the first to get access to the early release, news, and guides of the best Android games and apps.
No thanks
Sign Up
Subscribed Successfully!
You're now subscribed to APKPure.
Subscribe to APKPure
Be the first to get access to the early release, news, and guides of the best Android games and apps.
No thanks
Sign Up
Success!
You're now subscribed to our newsletter.