March 2019
Intermediate to advanced
336 pages
9h 9m
English
In the following code snippet, the main method calls the NodeBetweenValues property with firstProperty and secondProperty. The node property between values 1 and 5 is printed:
// main methodfunc main() { var linkedList LinkedList linkedList = LinkedList{} linkedList.AddToHead(1) linkedList.AddToHead(3) linkedList.AddToEnd(5) linkedList.AddAfter(1,7) fmt.Println(linkedList.headNode.property) var node *Node node = linkedList.NodeBetweenValues(1,5) fmt.Println(node.property)}
The main method creates a linked list. The nodes are added to the head and end. The node between values 1 and 5 is searched and its property is printed.
Run the following command to execute the doubly_linked_list.go file:
go run doubly_linked_list.go
After ...
Read now
Unlock full access