Polygon Triangulation
Daniel Vlasic
Algorithm -- Triangulating a Monotone Polygon -- Running
Time
-
initalization
-
merging 2 y-sorted chains : O(n)
-
initializing S and pushing first two vertices : O(1)
-
total : O(n)
-
for each new vertex (3 to n-1) we get at most 2 pushes
-
total number of pushes is bounded by 2n-4 (including
the initial 2)
-
total number of pops cannot exceed the number of pushes
-
total for all new vertices : O(n)
-
for the last vertex (n)
-
add diagonals to all remaining vertices on the stack except
the first and the last one
-
total : O(n)
-
total running time : O(n)
back