Why is a dummy node useful?

Practice this question from Merge Two Sorted Lists - Dummy node Pattern Practice Quiz, with options and an explanation.

Question

Why is a dummy node useful?

Option A — Correct answer

It avoids special-casing the merged head

Option B

It sorts all nodes

Option C

It detects loops

Option D

It stores all values in a hash set

Explanation

It avoids special handling for the first node in the merged list.

Merge Two Sorted Lists - Dummy node Pattern Practice Quiz

All questions · Previous question · Next question

Open on QuizMaker