Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

ex6 exam question about building a binary tree from a set of strings - bug in my code

_
_ginevra_ (620 points)
0 11 15
in Exam exercises by (620 points)
edited by
Hi all. I have written a code for the ex6, I know there is a bug and I know why and where, but I haven't been able to fix it using the same logic (like without using a for loop over each element of string). So if anyone is interested in finding a way and has found it then please share.
215 views

1 Answer

O
Oakandrew (6400 points)
7 27 64
by (6.4k points)

Hey.

First of all, it is prohibited to share an original code(you can loose points). Anyway I executed your program, and as u mentioned before your code returns IndexError. Each node can have 0,1,2 children nodes, at this point u should slice strings inside of "new" in another way.  Also remember your tree must be sorted according to algorithm described in exercise

Good luck