## Bloomberg LP Interview Question for Financial Software Developers

Country: United States
Interview Type: Phone Interview

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

``````struct node{
int info;
struct node *leftch;
struct node *rightch;
};

int AppendInBST(struct node **start, int num)
{
struct node *ptr,*tmp,*par=NULL;
tmp = (struct node*)malloc(sizeof(struct node));
tmp->info = num;
tmp->leftch= NULL;
tmp->rightch = NULL;

ptr = *start;
while(ptr != NULL)
{
par = ptr;
if(num > ptr->info)
ptr = ptr->rightch;
else if(num < ptr->info)
ptr = ptr->leftch;
else{
printf("Duplicate Entry\n");
return 0;
}
}
if(par == NULL)
{
*start = tmp;
}
else if(par->info > num)
par->leftch= tmp;
else if((par->info) < num)
par->rightch = tmp;
return 1;
}``````

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

How about this one? Since once mention the Btree I always think of recursive

``````struct node{
int data;
node *leftch;
node *rightch;
};

void intoatree(struct node **root, int n){
node *temp=new node;
(*temp).data=n;
(*temp).leftch=NULL;
(*temp).rightch=NULL;

node **par;

par=root;

if(*root==NULL){
*root=temp; //insert as the first node
}
else if((*(*par)).data==n){
cout<<"duplicate input"<<endl;
return;
}
else if((*(*par)).data>n){
*par=(*(*par)).leftch;
intoatree(par,n);
}
else{
*par=(*(*par)).rightch;
intoatree(par,n);
}

}``````

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

``````TreeNode* insertNode(TreeNode *root, TreeNode *newNode) {
if (root == NULL) {
// if there is no root, use current one as root
return newNode;
}

if (newNode->val >= root->val) {
root->right = insertNode(root->right, newNode);
} else {
root->left = insertNode(root->left, newNode);
}
return root;
}``````

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.