Skip to content

Commit 513b140

Browse files
authored
Update Diameter_Binary_Tree.cpp
Changes done
1 parent f9e6bef commit 513b140

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Data Structures/Trees/Diameter_Binary_Tree.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,27 @@ int main()
5656
root->left->left=newnode(9);
5757
root->right=newnode(1);
5858
root->left->right=newnode(6);
59+
root->left->right->left=newnode(7);
5960
// printing the final value
60-
cout<<"Diameter"<<final_diameter(root);
61+
cout<<"Diameter:"<<final_diameter(root);
6162
return 0;
6263
}
6364

6465
/*
6566
OUTPUT
6667
6768
5
68-
/ \ the longest path is from the node conatining value '4' to node containing
69-
3 1 value '1'.
69+
/ \
70+
3 1
7071
/ \
7172
9 6
72-
73-
Diameter:4
74-
73+
/
74+
7
75+
76+
Diameter:5
77+
78+
the longest path is from the node conatining value '7'
79+
to node containing value '1'.
80+
7581
7682
*/

0 commit comments

Comments
 (0)