سوال ۵۶ کنکور ارشد مهندسی کامپیوتر ۱۴۰۲
در مسئلهٔ یافتن پوسته محدب، تعدادی نقطه در صفحه داده شده است. هدف پیداکردن کوچکترین (کمترین محیط) چندضلعی محدب است که شامل همه نقاط باشد. بهترین الگوریتم ممکن برای یافتن این چندضلعی، چه مرتبه زمانی خواهدداشت؟
پاسخ صحیح: گزینهٔ C —
The convex hull of points in the plane can be computed in time, and this is optimal in the comparison model.
Upper bound — an algorithm exists. Classic algorithms achieve this bound:
- Graham scan: sort the points by polar angle (or by -coordinate, as in Andrew's monotone chain), then sweep once maintaining a stack and discarding non-left-turn vertices. Sorting costs ; the linear scan costs . Total: .
Lower bound — is unavoidable. Computing the hull is at least as hard as sorting: given numbers , lift each to the parabola point . All these points are in convex position, so the convex hull, read along its boundary, returns them in sorted -order. A hull algorithm faster than would sort faster than the comparison-sorting lower bound allows — a contradiction. Hence
Eliminating the other options.
| Option | Verdict |
|---|---|
| Cost of a naive "test every directed edge against all points" gift-wrapping bound, not optimal. | |
| Brute force over triples; far from optimal. | |
| Impossible — it would beat the sorting lower bound. | |
| Correct: optimal worst-case bound. |
So the best possible (optimal) algorithm runs in , option 3.
Exam trick: Convex hull is one of the canonical problems whose lower bound is proved by reduction from sorting (lift to a parabola). Whenever an exam asks for the "best possible" hull time, the answer is — unless it explicitly asks for an output-sensitive bound, in which case Chan's algorithm gives with = number of hull vertices.