Icona Graham Scan

1.0 by Tanishq Saluja


Apr 14, 2018

Informazioni su 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.

Novità nell'ultima versione 1.0

Last updated on Apr 14, 2018

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

Traduzione in caricamento...

Informazioni APP aggiuntive

Ultima versione

Richiedi aggiornamento Graham Scan 1.0

È necessario Android

4.2 and up

Mostra Altro

Graham Scan Screenshot

Commento Loading...
Ricerca...
Iscriviti ad APKPure
Sii il primo ad accedere alla versione anticipata, alle notizie e alle guide dei migliori giochi e app Android.
No grazie
Iscrizione
Abbonato con successo!
Ora sei iscritto ad APKPure.
Iscriviti ad APKPure
Sii il primo ad accedere alla versione anticipata, alle notizie e alle guide dei migliori giochi e app Android.
No grazie
Iscrizione
Successo!
Ora sei iscritto alla nostra newsletter.