Implement trees in Processing
in
Programming Questions
•
6 months ago
Hi, I'm trying to implement trees in Processing recursively.
Here is the class I defined :
It's the first time I've been trying recursivity in Processing, could someone help me solve this problem ?
Thank you very much !
Here is the class I defined :
- class Tree {
int page;
ArrayList next = new ArrayList();
Arbre precedent = new Arbre(-1);
Arbre(int p) {
page = p;
}
void addTreeSon(Tree son) {
son.precedent = this;
next.add(son);
}
void addElementSon(int n) {
Tree son = new Tree(n);
son.precedent = this;
next.add(son);
}
- Tree t = new Tree(0);
It's the first time I've been trying recursivity in Processing, could someone help me solve this problem ?
Thank you very much !
1