Tree Invert

William's Challenge 2 : inverting the nodes in a tree with a max of one child per node ie. a "stick"
Approach Repetitions Average msec * XQuery length
recursive function by William Candillion 100 2.01 357
recursive function by Chris Wallace 100 2.12 314
Invert via a sequence of names by Chris Wallace 100 3.1 441
* relative times are more useful than absolute times. At present the execution time includes compilation of locally-declared functions although the code is cached.