This question evaluates understanding of binary search tree properties, in-order traversal, in-place pointer manipulation, and algorithmic complexity when converting tree nodes into a sorted doubly linked list.

Convert a binary search tree into a sorted doubly linked list in-place. Reuse the existing tree nodes: the left pointer becomes prev and the right pointer becomes next. Do not allocate new nodes. Return the head of the doubly linked list. Ensure the list is sorted in nondecreasing order according to an in-order traversal, and specify how you handle duplicate keys. Provide both a recursive and an iterative solution, and analyze time and space complexity. Follow-ups: (