Mar-13-2018, 09:41 AM
(This post was last modified: Mar-13-2018, 01:32 PM by sparkz_alot.)
Essence of the question
construct a binary tree in which the cells would represent 1 letter from the word. but only with one slightly illogical detail.
Here is an example of a tree that should be made up: https://i.imgur.com/DVzakd3.png
in the beginning there was added 'test', then 'term'. and as you can see, r should go not after e, but after s. if now add the word 'tell' there - the letter l will go to the rith-child from r.
here's my code: https://hastebin.com/sohozozaho.py
the problem is immediately noticeable by the fact that when the tree is displayed, 1 symbol is displayed. that is, the tree does not want to write anywhere except at the root. I tried to use debug in PyCharm - I still do not understand where I made a mistake.
construct a binary tree in which the cells would represent 1 letter from the word. but only with one slightly illogical detail.
Here is an example of a tree that should be made up: https://i.imgur.com/DVzakd3.png
in the beginning there was added 'test', then 'term'. and as you can see, r should go not after e, but after s. if now add the word 'tell' there - the letter l will go to the rith-child from r.
here's my code: https://hastebin.com/sohozozaho.py
the problem is immediately noticeable by the fact that when the tree is displayed, 1 symbol is displayed. that is, the tree does not want to write anywhere except at the root. I tried to use debug in PyCharm - I still do not understand where I made a mistake.