Skip to main content

Merge Two Sorted Lists

Challenge on lesson: Checkpoint: The Linked Toolkit

The classic in-place merge. The boilerplate declares: ``c typedef struct SNode { int value; struct SNode *next; } SNode; /* merges ascending lists a and b into ONE ascending list; returns its head. On success *a_head and *b_head are set to NULL (the merge takes the nodes, no new allocations, no copying). Either input may be empty. Lists need not be pre-deduplicated; equal values keep both. */ SNode *s_merge_sorted(SNode **a_head, SNode **b_head); ``

Difficulty: intermediate

Back to lesson: Checkpoint: The Linked Toolkit