Tip 1: Handle edge cases. Empty deque, single line, parallel lines (same slope). Check before accessing deque elements. Tip 2: Use exact arithmetic for intersection comparisons. Avoid floating point. Cross-multiply instead of dividing. Tip 3: For debugging, print the hull after each insertion. Verify that intersection x-coordinates are increasing. Tip 4: Template your CHT. Once debugged, reuse. The logic is tricky to get right from scratch under time pressure.
Time complexity: .
Space complexity: in time and in space.