import java.util.LinkedList; public class BinaryTree { public static void main(String[] args) { int randoms[] = new int[]{67, 7, 30, 73, 10, 0, 78, 81, 10, 74}; Node roots = new Node(); for (int number : randoms) { roots.add(number); } //roots.preord…
# encoding=utf-8class node(object): def __init__(self,data,left=None,right=None): self.data = data self.left = left self.right = right tree = node('D',node('B',node('A'),node('C')),node('E',right=node('G',node('F')))) # 先序def front(tree): if tree ==…