我实现了插入插入功能,如下所示。
root = Node(8)
root.insert(3)
root.insert(10)
root.insert(1)
root.insert(6)
root.insert(5)
我给出了以下输入
Traceback (most recent call last):
File "C:\Users\\Desktop\BST.py", line 45, in <module>
root.insert(5)
File "C:\Users\\Desktop\BST.py", line 15, in insert
self.left.insert(data)
File "C:\Users\\Desktop\BST.py", line 20, in insert
self.data.insert(data)
AttributeError: 'int' object has no attribute 'insert'
但是在root.insert(6)之后会抛出一个错误。
{{1}}
我也试过其他数字,但我仍然得到错误。任何人都可以给我一个理由吗?任何帮助表示赞赏。感谢。
答案 0 :(得分:0)
将//skin is the skin that you use
Label myLabel = new Label(text, new LabelStyle(skin.get(LabelStyle.class)));
(第20行)替换为self.data.insert(data)