sjs3
BAN USER
Questions (1)
Comments (4)
Reputation 10
- 0of 0 votes
AnswersWrite an algorithm to print out how many extra duplicates there are in a binary search tree.
- sjs3 in United States for amazon local
input 1:
2
/ \
1 2
output 1:
2 1
input 2:
3
/ \
2 3
/ \ \
1 2 4
/ \
3 4
\
5
\
5
output 2:
2 1
3 2
4 1
5 1
Given:
Node {
int value;
Node left;
Node right;
}| Report Duplicate | Flag | PURGE
Amazon Trees and Graphs
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
This is nothing but a catalan number. The formula is (2n)!/(n+1)! n!
- sjs3 November 01, 2012