junior engineer interview questions shared by candidates
count the number of duplicates in a binary tree in O(n) time O(1) space.
In order traversal passing down the parent key value to the right child and the previously passed value to the left child, checking for duplicates and adding one to the returned value as you go along.
there is no such info left-right-parent comparision info in a *BT*. I think you are talking about *BST*...
yes you are correct, I meant a BST
See Interview Questions for Similar Jobs
- Software Engineer
- Software Developer
- Java Developer
- Senior Software Engineer
- Assistant Software Engineer
- Trainee Software Engineer
- Associate Software Engineer
- Software Development Engineer
- Business Analyst
- Web Developer
- QA Engineer
- Systems Engineer
- Junior Software Engineer
- Trainee Engineer