Question: You are given a recursive notation of a binary tree: each node of a tree is represented as a set of three elements value of

 You are given a recursive notation of a binary tree: each

You are given a recursive notation of a binary tree: each node of a tree is represented as a set of three elements value of the node left subtree; right subtree So, a tree can be written as (value left subtcee right subtcee). It is guaranteed that 1 s value 109. If a node doesn't exist then it is represented as an empty set: . For example, here is a representation of a tree in the given picture 5 (11) (4 Your task is to obtain a list of nodes, that are the most distant from the tree root, in the order from left to right In the notation of a node its value and subtrees are separated by exactly one space character. Example For the output should be tceeBettou(tree)[5, 11, 4]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!