Skip to content

Commit 8b1ccf6

Browse files
authored
Update Average of Levels in Binary Tree
1 parent 39e353e commit 8b1ccf6

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

Average of Levels in Binary Tree

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
'''
2-
* Programmer : Dhruv Patel
3-
* Problem Name : Average of Levels in Binary Tree
4-
* Used In : LeetCode Weekly Contest 40
5-
* Used As : Problem
6-
* Problem =>
7-
* Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.
8-
* Thoughts =>
9-
* The following code initializes the class TreeNode and implements a method averageOfLevels which takes the input of a root
10-
* and return the list of data_type Float. There are several ways which one can attack this problem. One of the naive way is to
11-
* use Breadth First Search algorithm to iterate through nodes.
12-
*
13-
* Sample Input =>
14-
* 3
15-
* / \
16-
* 9 20
17-
* / \
18-
* 15 7
19-
*
20-
* Sample Output =>
21-
* [3, 14.5, 11]
2+
# Programmer : Dhruv Patel
3+
# Problem Name : Average of Levels in Binary Tree
4+
# Used In : LeetCode Weekly Contest 40
5+
# Used As : Problem
6+
# Problem =>
7+
# Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.
8+
# Thoughts =>
9+
# The following code initializes the class TreeNode and implements a method averageOfLevels which takes the input of a root
10+
# and return the list of data_type Float. There are several ways which one can attack this problem. One of the naive way is to
11+
# use Breadth First Search algorithm to iterate through nodes.
12+
#
13+
# Sample Input =>
14+
# 3
15+
# / \
16+
# 9 20
17+
# / \
18+
# 15 7
19+
#
20+
# Sample Output =>
21+
# [3, 14.5, 11]
2222
'''
2323
#!/bin/python3
2424
import queue

0 commit comments

Comments
 (0)