Tree

Node Class public class Node { private int data; private ArrayList arraylist; public Node(int data) { this.data=data; this.arraylist=new ArrayList(); } public int getData() { return data; } public void setData(int data) { this.data = data;…