Here's an example implementation of a binary tree inversion algorithm using recursion in C#:
main.cs639 chars33 lines
This function takes the root node of a binary tree and recursively inverts its left and right subtrees. The basic idea is to perform a depth-first traversal of the tree, swapping the left and right subtrees for every node encountered. Finally, the resulting inverted tree is returned.
gistlibby LogSnag