The example Link List in this section uses a Node as a Head pointer. This data value in this node is ignored (it stays zero - the initialized value - through all insertions). It I snot clear why one should use a Node as a pointer instead of pointing to the Node itself? If one points to the first Node as Head, it saves space (one less Node object) and is also more intuitive? Under this mechanism, the logic for insertingAtHead would run as follows:
Node new_node = new Node();
new_node.data = 2; //sample made up value
new_node.next = headNode;
headNode = new_node;
I have tried this and it works fine. Could someone share what is the typical LinkedList HeadNode implementation in Java? Should one use a Node just for pointer purpose or is it okay to label the leading Node as Head?