GATE Computer ScienceHardGATE CS (PYQ pattern)

Graham scan or Andrew's monotone chain is used on the points (0,0), (4,1), (2,2), (6,3), (3,5), (8,6), (5,7), (1,8), (7,3), (4,4), (2,6), (9,4), (5,0), (0,5). How many points lie on the convex hull (no input point lies on a hull edge between two hull vertices)?

  1. A. 6
  2. B. 8
  3. C. 9
  4. D. 7

Correct answer: D. 7

The hull is (0,0), (5,0), (9,4), (8,6), (5,7), (1,8), (0,5); every other point is strictly inside. Counter-clockwise turns are tested with the cross product, popping points that make a clockwise or collinear turn.

More Algorithms questions

Exams that ask this topic