March 2019
Intermediate to advanced
336 pages
9h 9m
English
The NodeBetweenValues method of the LinkedList class returns the node that has a property lying between the firstProperty and secondProperty values. The method traverses the list to find out whether the firstProperty and secondProperty integer properties match on consecutive nodes, as follows:
//NodeBetweenValues method of LinkedListfunc (linkedList *LinkedList) NodeBetweenValues(firstProperty int,secondProperty int) *Node{ var node *Node var nodeWith *Node for node = linkedList.headNode; node != nil; node = node.nextNode { if node.previousNode != nil && node.nextNode != nil { if node.previousNode.property == firstProperty && node.nextNode.property == secondProperty{ nodeWith = node break; } } } return nodeWith ...Read now
Unlock full access