concept discussion in category algorithms
appears as: discussion, discussion

This is an excerpt from Manning's book Algorithms and Data Structures in Action.
#11 Finally, we reconnect y to the tree by setting it as x’s new right child.
Listing 10.18 The SsNode:: mergeChildren method
function mergeChildren(firstChild, secondChild) #1 if secondChild != null then #2 newChild ← merge(firstChild, secondChild) #3 this.children.delete(firstChild) #4 this.children.delete(secondChild) #5 this.children.add(newChild) #6 function merge(firstNode, secondNode) #7 assert(firstNode.leaf != secondNode.leaf) #8 if firstNode.leaf then return new SsNode(true, points=firstNode.points + secondNode.points) #9 else return new SsNode(false, children=firstNode.children + secondNode.children) #10
Quite often, besides computing the minimum distance of a certain vertex from a source vertex, we are also interested in discovering what’s the shortest path to that vertex, meaning which edges should be followed, and in which sequence, to get from source to destination.