題組題幹(本題:㉑,共 3 小題)點擊展開
Consider binary search for finding extremal points of a convex polygon in the given direction.
Let Q be a convex polygon, represented by the vertices of its boundary in clockwise order, say, for example, with and , and let be a given vector. See Figure (a) for an illustration. Consider the projection of points in Q onto . For any two points , we write , if the projection of r lies further from the starting end of than the projection of q. See Figure (b) for an illustration, where is further than in the direction of .
A point is said to be maximal with respect to if there exists no point such that . Similarly, a point is minimal with respect to if there exists no such that . For example, in Figure (a), both and are maximal points of Q and is the minimal point of Q.
Let denote the boundary of the convex polygon Q and consider the properties of Q.
Consider the following sketch of pseudo-code that aims to compute a maximal point of Q for the given direction by binary search.
a ← 0, b ← n. // to search the range [1,...,n-1]
While a < b - 1, repeat the following.
c ← ⌊(a+b)/2⌋.
Set b ← c if [a,c] contains a maximal point of Q in the direction ℓ⃗.
Otherwise, set a ← c.
Output a if it is maximal. Otherwise, output b.
Regarding the above algorithm, which of the following statements is/are true?
