March 2019
Intermediate to advanced
336 pages
9h 9m
English
The AddAfter method adds the node after a specific node. The AddAfter method of LinkedList has nodeProperty and property parameters. A node with the nodeProperty value is retrieved using the NodeWithValue method. A node with property is created and added after the NodeWith node, as follows:
//AddAfter method adds a node with nodeProperty after node with propertyfunc (linkedList *LinkedList) AddAfter(nodeProperty int,property int) { var node = &Node{} node.property = property node.nextNode = nil var nodeWith *Node nodeWith = linkedList.NodeWithValue(nodeProperty) if nodeWith != nil { node.nextNode = nodeWith.nextNode nodeWith.nextNode = node }}
You then get the following output when the AddAfter method is invoked when ...
Read now
Unlock full access