Data Structures: Symbolic Algebra with Trees

So, I will soon be a student at a University studying Computer Science, and I have taken it upon myself to study ahead for my Data Structures class. I am currently on the 7th week of assignments, and we have been working in Java using a class named *Cons* which represents the same cons structure in Lisp. If you don't know what a cons is -> cons - Wikipedia, the free encyclopedia

So this is an assignment, and I understand the policy with receiving help on assignments, but I'm simply looking for guidance. The basic structure for a tree that's represented as an equation is:

This is just a very simple representation of an equation, but the other test cases are much more involved. For a function, Cons solve(Cons e, String v), return the part of the equation that is equal to the String v. So if you pass in the Cons illustrated with the String *x*, you would simply return the e since *x = y - z*, but if I was looking for String *y*, you would return a Cons that has *y = x - z*, but represented as a tree of Cons.

If anyone is familiar with Cons/Lisp and has any guidance, that would be awesome. I'm having a hard time understanding how to rotate the tree to resemble basic Algebra. This may be a long-shot, but help would be greatly appreciated. The last few posts about unrelated topics didn't really receive much feedback at all.

Re: Data Structures: Symbolic Algebra with Trees

Quote:

I'm having a hard time understanding how to rotate the tree to resemble basic Algebra

The tree is just another way to express the equation. Everything works just as it does in algebra.

To keep the equation in balance, what you do to the left side of the = must also be done to the right side.

I don't understand exactly what it is that you dont understand.

Re: Data Structures: Symbolic Algebra with Trees

Yeah, I didn't really know how to word what the issue was.. But I believe I just solved the problem. I was just having an issue visualizing what was really going on whenever you preformed the "algebra". Thanks for the reply, but I'm good now.