A typical node in a doubly linked list has three fields: a data field, a left link field, and a right link field. To imp
Posted: Tue Apr 12, 2022 10:21 am
A typical node in a doubly linked list has three fields: a data field, a left link field, and a right link field. To improve space efficiency, we may implement a doubly linked list using only two fields per node: a data field a and a linked field that is derived from the left and right links using the bitwise XOR operation. Suppose the list {HAT, CAT, EAT, BAT} is stored as a doubly linked list by the following three-field representation: Address Ox0061FF14 0x0061FF08 Ox0061FEFC Ox0061FEFO Data HAT CAT EAT BAT Left link 0 Ox0061FEFC 0x0061FF14 0x0061FF08 Ox0061FEFC Ox0061FEFO Right link Ox0061FF08 0 What are the values of (1)-(4) for the corresponding two-field representation? (8%) (5)Explain how to traverse a two-field doubly linked list from left to right and from right to left. (5%) Address Ox0061FF14 0x0061FF08 0x0061FEFC Ox0061FEFO Data HAT CAT EAT BAT Link (1) (2) (3) (4)