Microsoft Interview Question for Software Engineer / Developers






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

I think it is about two sorted linked lists right...

- netappreject July 10, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Yes I guess they are already sorted which we have to merge.

- Rahul July 11, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

hi.. can you give the questions little more clearly

- jomb August 21, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Thanks Rahul. Did u appeared in MBD one the last saturday? I will shortly put the answer.

- netappreject July 11, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I attended the written test conducted yesterday.

- Rahul July 11, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

In delhi. A friend of mine was asked the same question in interview the last saturday. Did u attended the test at Nehru Place office?

- netappreject July 11, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

can you plz share other details, that u faced?

- netappreject July 11, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

struct node* sortedMergeRecursive(struct node* a, struct node* b)
{

struct node* result = NULL;
if (a==NULL) return(b);
else if (b==NULL) return(a);

// Pick either a or b, and recur
if (a->data <= b->data)
{
result = a;
result->next = sortedMergeRecursive(a->next, b);
}
else
{
result = b;
result->next = sortedMergeRecursive(a, b->next);
}
return(result);
}

- Anonymous July 13, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

You are not supposed to create a node within the function.

- Anonymous August 19, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

node mergeSort(node a, node b){
	if(a == null) return b;
	if(b == null) return a;
	if(a.value <= b.value){
		a.next = mergeSort(a.next, b);
		retrun a;
	}else{
		b.next = mregeSort(a, b.next);
		return b;
	}
}

- Anonymous September 02, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Node Merge(Node L,Node a,Node b)
{
Node t=L;
do
{
if(a->element<b->element)
{
t->next=a;
t=a;
a=a->next;
}
else
{
t->next=b;
t=b;
b=b->next;
}
}
while(a!=null && b!=null)

if(a==null)
t->next=b;
if(b==null)
t->next=a;


return L;
}

- Danny September 20, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

assumiong the given linked list are sorted its just use use the merge procedure to murge the linked lists :)

struct node *MergeLinkedlist(struct node *l1,struct node *l2)
{
struct node *temp;
struct node *head=NUll;
struct node *temp1=l1;
struct node *temp2=l2
while(temp1 && temp2)
{
if(temp1->info<=temp2->info)
{
if(!head)
{head=temp1;
temp=head;
temp1=temp1->next;
temp->next=NULL;
}
else
{
temp->next=temp1;
temp=temp1;
temp1=temp1->next;
temp->next=NULL;
}
}
else
{
if(!head)
{
head=temp2;
temp=temp2;
temp2=temp2->next;
temp->next=NULL;
}
else
{
temp->next=temp2;
temp=temp2;
temp2=temp2->next;
temp->next=NULL;

}
}


}

if(!temp1)
{
while(temp1)
{
if(!head)
{head=temp1;
temp=head;
temp1=temp1->next;
temp->next=NULL;
}
else
{
temp->next=temp1;
temp=temp1;
temp1=temp1->next;
temp->next=NULL;
}}
if(!temp2)
{
while(temp2)
{
if(!head)
{
head=temp2;
temp=temp2;
temp2=temp2->next;
temp->next=NULL;
}
else
{
temp->next=temp2;
temp=temp2;
temp2=temp2->next;
temp->next=NULL;

}


}




}

}
return head;
}

- geeks July 19, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I don't feel good,Why Do Guys Directly give Code??There must be a decent discussion irrespective of toughness of a problem...Anyway we may apply basic idea like...Just reach @ End of the first link list and give pointer of the first node of the second link list to its Last node next part..Now we can traverse both the list via Single pointer. We can sort resultant link list..

- User March 08, 2012 | Flag Reply


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