Microsoft Interview Question for Software Engineer in Tests


Country: United States




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

And what kind of program should I write about this binary tree?

- eugene.yarovoi April 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Sorry for the unclear question. WAP to implement a BT ( insert, delete and search operations) where the left node is connected to the right node.

- ps April 17, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I presume that each node has a pointer to its left child and the left child has a pointer to its sibling. Thus rightchild(x) is obtained by leftchild(x)->sibling. What happens if a node has a right child only? How is this expressed?

- Event Horizon April 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think the tree should look like this :

5
   /        \
 3     -      7
   \          /     \
   4       12 -   6

Can someone explain/provide a link on how to implement a binary tree (not BST) with the insertion and deletion operations? Thanks in advance.

- ps April 22, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

we can define a struct
strcut BST
{
BST Left;
int data;
BST Right;
BST LeftToRightLink
}

void INSERT (BST parent , BST node , int iData)
{
BST Temp = node;
parent = node;
if( temp == NULL)
{
temp = new BST();
temp.Left = NULL;
temp.data = iData;
temp.Right = NULL;
temp.LeftToRightLink = parent
return;
}

//Use recursion
if(iData > Temp.Data)
INSERT (Parent , Temp.Right)
else
INSERT (Parent , Temp.Left)

}

- Irshad May 04, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

why
temp.LeftToRightLink = parent ?

shouldn't above be like
temp.LeftToRightLink = parent.right;

- rawat011 June 18, 2013 | Flag
Comment hidden because of low score. Click to expand.


Add a Comment
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.

Learn More

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.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More