GRAHAM_SCAN(Q)
- Initialize a stack S
- p1 ← lowest-leftmost point in Q
- POLAR_SORT(Q,p1)
- Q.push(p1)
- Q.push(Q[2])
- Q.push(Q[3])
- for i ← 4 to n do
- p ← Q[i]
- while not IS_LEFT_TURN(p, S.TOP(),S.NEXT_TO_TOP()) do
- S.POP()
- s.PUSH(p)
- return S
JARVIS_MARCH(Q)
- p ← FIND_MINIMUM(Q)
- plast ← p-(1,0)
- L.insert(p)
- do
- tmp ← FIND_MINIMAL_POLAR_ANGLE(plast,p, Q)
- if tmp != L[0]
- L.insert(tmp)
- plast ← p
- p ← tmp;
- while p != L[0]