Merge Two Sorted Linked Lists, two ways

Try:
CALL
1 / 1

Code

The highlighted line runs next. The pill shows the live values in the running call.

Cost

Work done so far, and how the two solutions compare

The lists

Nodes stay in place; only the next arrows change

Keyboard: ← → step, Space play or pause. Up to 5 sorted values per list (−99 to 99); either list may be empty. On equal values, the recursive version takes list1 first (<=) and the iterative one takes list2 first (<). The merged values are the same, but which node goes first differs.