From 4d5c78fcd689cc115b6e74b12b5102ba7c77d365 Mon Sep 17 00:00:00 2001 From: HC123abc <126921906+HC123abc@users.noreply.github.com> Date: Mon, 18 Sep 2023 10:38:55 -0400 Subject: [PATCH 1/2] test --- src/Tree.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Tree.java b/src/Tree.java index 458a7c7..6239413 100644 --- a/src/Tree.java +++ b/src/Tree.java @@ -1,2 +1,5 @@ + public class Tree { + private Object root; + private Object; } From 6218e9f5bef497cbd359c1b9ad2a9381897a6562 Mon Sep 17 00:00:00 2001 From: HC123abc <126921906+HC123abc@users.noreply.github.com> Date: Mon, 18 Sep 2023 15:13:04 -0400 Subject: [PATCH 2/2] first few methods --- src/Tree.java | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/Tree.java b/src/Tree.java index 6239413..a4277c4 100644 --- a/src/Tree.java +++ b/src/Tree.java @@ -1,5 +1,35 @@ +import java.util.ArrayList; public class Tree { private Object root; - private Object; + private ArrayList subtree; + + public Tree( Object root, ArrayList subtree){ + this.root = root; + if (subtree == null){ + this.subtree = new Arraylist(); + } + else { + this.subtree = subtree; + } + } + + public boolean isEmpty(){ + return this.root == null; + } + + public int len(){ + if (this.isEmpty()){ + return 0; + } + else{ + int size = 1; + for(Tree i : this.subtree){ + size += i.len(); + } + return size; + } + } + + }