Please answer the questions below (Make sure to identify your answer by the ques
ID: 3921283 • Letter: P
Question
Please answer the questions below (Make sure to identify your answer by the question number; Draw the list to show the changes applied after executing EACH statement for sub-questions a and c. Use "/" in the box indicates a null pointer. 2 point each): list.next.next = list.prev; Will you lose access to any node because of the operation in step (a)? Why? Based on the result of step (a), apply the following: list.prev = list.next.next; After the steps in question (c), will you lose access to any node because of the operations in step (c)? Why?Explanation / Answer
a)
list is in first node
So list.prev=null as given in question
Now list.next=2
list.next.next=2.next
Given list.next.next=list.prev
Hence 2.next=null
b) Since the next pointer of node 2 is made null in question(a) the access to node 3 from 2 is lost
c)
list.prev=list.next.next=2.next=null
d)
There is no loss of access to any node due to operation in question(c) as the list.prev is already null and is not pointing to any other node