題組內容

3.(20%) Given a doubly linked list which has a header field for the dummy head node and a trailer field for the dummy tail node. Suppose that each node has a next field for the next node and a prev field for the previous node. Please complete the following task with proper pseudo code.

b. What are the steps in sequence for adding a node new_node to the head of the list? (Hint: The condition for an empty list is header . next == trailer or trailer .prev == header.)