Homework08
A MathWikiből
A lap korábbi változatát látod, amilyen Imran (vitalap | szerkesztései) 2021. május 4., 21:10-kor történt szerkesztése után volt.
Problem 1: New Tree Methods
- Write an is_path(self) method for the class Tree which returns True if the tree is a long path without a junction. False otherwise. The tree is a path if all of the nodes except the root have at most one branches.
- Write a path(self) method for the class Tree which returns all paths from the leaves to the root of a given binary tree.
Problem 2: Proper Calculator
Write modify the calculator in the exercise to handle parantheses such that it calculates the input based on the parentheses.
Example:
2+(7*3) --> 23 (2+7)*3 --> 27
Note
each problem counts for 2 points