For those still working on HW 3.5, here are the signatures for my circular recursive functions. You are, of course, free to devise your own solution.
Terminal calls subtree. Subtree calls itself and terminal. After building a tree for level k, I call terminal on each leaf node, which calls subtree ... If I built the tree, I would have both of these return a TreeNode. Since I don't bother, the return value is void. Both trees print information. Terminal prints a printf statement in the base case. subtree prints an if-then-else statement every time, except in the base case. Neither needs any information not passed in as a parameter. (Remember that the length of the array a is part of the array) // Generate a tree at one level // Parameters // indent - How many tabs to print // level - How big is the sorted subarray // a - Current state of the variables void terminal(int indent, int level, char a[]) // Generate the logic to insert one variable into a subarray // Parameters // indent - How many tabs to print // level - How big is the sorted subarray // pos - Where are we in the processes of inserting into subarray // a - Current state of the variables void subtree(int indent, int level, int pos, char a[]) - jeff parker - axiowave networks