mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-05-09 15:43:48 +08:00
Fix #1
This commit is contained in:
@@ -63,11 +63,11 @@ namespace geometry::grahamscan {
|
||||
* @param S Stack to be used for the process.
|
||||
* @returns @param Point Co-ordinates of the Point <int, int>
|
||||
*******************************************************************************/
|
||||
Point nextToTop(std::stack<Point> S) {
|
||||
Point p = S.top();
|
||||
S.pop();
|
||||
Point res = S.top();
|
||||
S.push(p);
|
||||
Point nextToTop(std::stack<Point> *S) {
|
||||
Point p = S->top();
|
||||
S->pop();
|
||||
Point res = S->top();
|
||||
S->push(p);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace geometry::grahamscan {
|
||||
// Keep removing top while the angle formed by
|
||||
// points next-to-top, top, and points[i] makes
|
||||
// a non-left turn
|
||||
while (S.size() > 1 && orientation(nextToTop(S), S.top(), points[i]) != 2) {
|
||||
while (S.size() > 1 && orientation(nextToTop(&S), S.top(), points[i]) != 2) {
|
||||
S.pop();
|
||||
}
|
||||
S.push(points[i]);
|
||||
|
||||
Reference in New Issue
Block a user