I am working on a binary tree class for one of my algorithms class. I have gone a little off the rails and implemented generators for the different tree traversal techniques.
One thing I don't like though is all the redundancy. All of these generators are essentially the same but just the order in which nodes and trees are evaluated is changed. Is there anyway to simplify the code or reduce the redundancy?