Closed RMPR closed 6 years ago
Hi there. Thanks for the PR :) Did you actually receive this problem from http://dailycodingproblem.com? This was not in the set I received. If yes, happy to pull if you use the same format I used everywhere else (doctesting and single self-contained function).
Regarding representing a tree, I would use nested tuples.
So instead of ['*', '+', '+', 3, 2, 4, 5]
, using something like ('*', ('+', 3, 2), ('+', 4, 5))
.
See for reference problems 8, 36, 48.
Hello Riccardo, I received my problems from https://www.dailycodingproblem.com/ it's a mailing list, so one problem per day, I got your point with nested tuples, but I was just trying to be memory efficient. I'll check the reference problems and come back to you. Regards.
Closing after a week. I've added my own solution to the repository, have a look!
I represent binary tree with a table, since there is no pointers in python, The matter of this solution is that the tree need to be complete or almost complete, suggestions are welcomed.