What is the main purpose of a header (dummy) node in a linked list?
Correct answer B. To remove special cases for inserting or deleting at the front of the list
A header node sits before the first real element and holds no user data, so every real node, including the first, has a predecessor. Insertion and deletion code can then treat all positions the same way without checking whether the head pointer itself must change. It may optionally store a count, but its key role is simplifying the boundary cases.
Answer checked How we write and check questions
Discussion