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.= / \ x - / \ y z
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.