我试图使用链表而不是arraylist创建一个完整的二叉树,而不比较节点值.我的意思是插入一个新值,我不希望比较该值是否小于,大于或等于根值,以便将其添加到左侧链接或右侧链接,但仍然能够创建一个完整的二叉树.
你认为这可能吗?如果是的话,你有任何想法,或者你能指出我可以使用/阅读的东西吗?
编辑:
Here's an example to make my question more clear: I am adding the numbers in the order presented through the insert method: 1 2 3 4 5 6 the insert method takes care of the structure of the tree. 1 becomes the root since it's the first value added. 2 is the left child of 1 3 the right child of 1 4 the left child of 2 5 the right child of 2 6 the left …