Bloomberg LP Interview Question Financial Software Developers
- 1of 1 vote
Q: Do you know what is a Binary tree? How would you go about coding for addition of a new element to Binary tree?
A: I asked if they want a Binary Tree or a BST? When he said BST I just said we can have a recursive function in which we pass the root of the tree and see if the value to be added is smaller or bigger than the root, and depending on result, we go to left or right of the tree, assuming the left (or right) is not null. If null, just use new to create a memory location, put the value, and use the left reference of the root to link to this new memory. Simple basic stuff.
Country: United States
Interview Type: Phone Interview