Please answer the questions below Make sure to identify your

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?

Solution

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

 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 sta

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site