Well, I took most of it.
In fact, I likely took pretty much all of it.
It's been updated as you can see.
In the other thread.
Type: Posts; User: javapenguin
Well, I took most of it.
In fact, I likely took pretty much all of it.
It's been updated as you can see.
In the other thread.
I'm having a very hard time trying to figure out what he wants me to do with those tokens.
And how to evaluate the expressions.
I continue to update and I feel like I'm talking to a brick...
public abstract class Node
{
protected Node left, right, parent;
protected Object data;
protected ArrayList<Object> childrenHolder;
public Node(Object data, Node parent, Node left, Node ...
Ok, I'm thinking that perhaps for a + b * c
I do something like this:
OperandStack.push('+');
OperandStack.push('*');
OperatorStack.push(a);
OperatorStack.push(b);
OperatorStack.push(c);
PDF was updated.
https://blackboard.ilstu.edu/webct/urw/lc764539604011.tp764539626011/RelativeResourceManager/sfsid/857411743031
public abstract class Node
{
protected Node left, right, parent;
protected Object data;
protected ArrayList<Object> childrenHolder;
public Node(Object data, Node parent, Node left, Node ...
I have this, but I don't know how to make the OperatorNode class evaluate the expressions.
public class BST<T extends Comparable<T>>
{
private class Node<T>
{
private T data;
private...
Hey, is it legal to have switch structures within switch structures
c =this.getData();
switch(c)
{
case( ' ( ' )
bla bla bla;
Anybody home?
I see a class for a binary tree, but no way to evaluate its subtrees. Even if there are, I cannot understand how to do it.
should I create the expression tree class first before:
1. Create a...
This tree is a binary tree. That might be why. ;)
:-L
A non-leaf Node could have two non-leaf nodes, which then each have two non-leaf nodes, which then each have two non-leaf nodes and which...
Well, how do I do the evaulate method for OperatorNode? I don't know how to figure out the values in each subtree. It seems to involve recursion, but I can't figure it out at the moment.
So how do I keep track of the data at that Node?
:confused::confused::confused::confused:^:)^^:)^:-??:-??:-??:-??:-??
public abstract class Node
{
protected Node left, right, parent;
protected Object data;
protected ArrayList<Object> childrenHolder;
public Node(Object data, Node parent, Node left, Node ...
On getData() could I make it abstract and change the return type to Object?
Ok, so what about my getData() method? Make it abstract too?
It is currently returning a variable of type T.
Ok, if I don't need the generic, why not?
It's subclasses hold one particular type of data, but as that type is different, I cannot have a get Data method in my Node class. Are you suggesting I...
Ok, based on the pdf, am I doing this right?
I have no idea what to do with tokens? Never handled them before.
public abstract class Node <T>
{
protected Node<T> left, right, parent;
protected T data;
protected ArrayList<T> childrenHolder;
public Node(T data, Node<T> parent, Node<T> left, Node<T>...
I'm wondering if, based on the pdf assignment, I am doing this Node class right. I have a feeling I'm doing too much.
Can I have a class, an abstract class moreover, that has two subclasses as objects?
I think that this one may need recursion as well as Nodes.
I almost wish I could have Node itself keep track...