March 2019
Intermediate to advanced
336 pages
9h 9m
English
The AddToHead method of the doubly LinkedList class sets the previousNode property of the current headNode of the linked list to the node that's added with property. The node with property will be set as the headNode of the LinkedList method in the following code:
//AddToHead method of LinkedListfunc (linkedList *LinkedList) AddToHead(property int) { var node = &Node{} node.property = property node.nextNode = nil if linkedList.headNode != nil { node.nextNode = linkedList.headNode linkedList.headNode.previousNode = node } linkedList.headNode = node}
The example output after the AddToHead method was invoked with property 3 is as follows. A node with property 3 is created. The headNode property of the list has a property ...
Read now
Unlock full access