## Interview Question

Country: United States

Comment hidden because of low score. Click to expand.
3
of 3 vote

void average(Node n, int sumcount[]) {
if (n == null) return;
sumcount[0] += n.data;
sumcount[1] += 1;
average(n.left, sumcount);
average(n.right, sumcount);
}

Average will be sumcount[0]/sumcount[1]

Comment hidden because of low score. Click to expand.
0
of 0 vote

get the sum of value of all nodes through Inorder tree traversal.
also get the number of nodes through in order tree traversal.

and at the end, find the average by dividing these two.

Comment hidden because of low score. Click to expand.
0
of 0 vote

get the sum of value of all nodes through Inorder tree traversal.
also get the number of nodes through in order tree traversal.

and at the end, find the average by dividing these two.

Comment hidden because of low score. Click to expand.
0
of 0 vote

get the sum of value of all nodes through Inorder tree traversal.
also get the number of nodes through in order tree traversal.

and at the end, find the average by dividing these two.

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.