Euler tour of tree has been already discussed which flattens the hierarchical structure of tree into array which contains exactly 2*N-1 values. In this post, the task is to prove that the degree of Euler Tour Tree is 2 times the number of nodes minus one. Here degree means the total number of nodes get traversed in Euler Tour.
Using Example 1:
It can be seen that each node’s count in Euler Tour is exactly equal to the out-degree of node plus 1.
Mathematically, it can be represented as:
Total represents total number of nodes in Euler Tour Tree
represents ith node in given Tree
N represents the total number of node in given Tree
represents number of child of
Calculated Answer is 15 and is Equal to Actual Answer Calculated Answer is 17 and is Equal to Actual Answer
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Euler Tour of Tree
- Euler tour of Binary Tree
- Euler Tour | Subtree Sum using Segment Tree
- Count the nodes of the tree which make a pangram when concatenated with the sub-tree nodes
- Common nodes in the inorder sequence of a tree between given two nodes in O(1) space
- Count of all prime weight nodes between given nodes in the given Tree
- Construct XOR tree by Given leaf nodes of Perfect Binary Tree
- Minimum difference between any two weighted nodes in Sum Tree of the given Tree
- Total sum except adjacent of a given node in a Binary Tree
- Sum of all nodes in a binary tree
- Subtree of all nodes in a tree using DFS
- XOR of all the nodes in the sub-tree of the given node
- Number of nodes greater than a given value in n-ary tree
- XOR of path between any two nodes in a Binary Tree
- Sum of all the Boundary Nodes of a Binary Tree
- Product of all nodes in a Binary Tree
- Count greater nodes in AVL tree
- Count the nodes in the given tree whose weight is even
- Convert a tree to forest of even nodes
- Print all leaf nodes of an n-ary tree using DFS
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.