Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Data Structures: Symbolic Algebra with Trees

  1. #1
    Member Staticity's Avatar
    Join Date
    Jul 2011
    Location
    Texas
    Posts
    105
    My Mood
    Inspired
    Thanks
    3
    Thanked 5 Times in 5 Posts

    Lightbulb 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:
                 =
                /  \
               x    -
                   /  \
                  y    z
    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.
    Simplicity calls for Complexity. Think about it.


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 262 Times in 231 Posts

    Default Re: Data Structures: Symbolic Algebra with Trees

    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.

  3. #3
    Member Staticity's Avatar
    Join Date
    Jul 2011
    Location
    Texas
    Posts
    105
    My Mood
    Inspired
    Thanks
    3
    Thanked 5 Times in 5 Posts

    Default 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.
    Simplicity calls for Complexity. Think about it.

Similar Threads

  1. Replies: 0
    Last Post: November 6th, 2011, 02:55 PM
  2. Is algebra possible in Java?
    By javapenguin in forum What's Wrong With My Code?
    Replies: 3
    Last Post: June 12th, 2010, 10:28 AM
  3. Data Structures(Binary Search Tree to AVL Tree)ASAP
    By jfAdik in forum Algorithms & Recursion
    Replies: 2
    Last Post: April 5th, 2010, 03:58 AM
  4. PQ Trees
    By copeg in forum Algorithms & Recursion
    Replies: 1
    Last Post: March 19th, 2010, 09:40 PM
  5. Code wise working of Computer Algebra Systems
    By helloworld922 in forum Java Theory & Questions
    Replies: 1
    Last Post: July 7th, 2009, 07:45 AM