#3 Parse & ReverseParse a Binary Tree

2020. 8. 15. 16:06PS/도전

All problems are from https://www.dailycodingproblem.com/

 

Solution Codes : https://github.com/Kusin/DailyCoding

 

Kusin/DailyCoding

DailyCodingProblem. Contribute to Kusin/DailyCoding development by creating an account on GitHub.

github.com

#3 

An opportunity to practice Python!

 

Solution

Generally, inorder Traversal can't recover the origianl Tree since there are more than one possible trees.

However, if we put the information about its children, we can restore the original Tree

Implementation

 

 

Tips :

- How to change many lines into one

Use Semicolons!

(before) 

a=3

b=3

print(a+b)

 

(after)

a=3; b=3; print(a+b)

 

 

-difference between instance variable and class variable.

although I didn't use the concept on this problem, it was helpful for me to understand python

If you know korean, check this link. https://wikidocs.net/1744

728x90