Microsoft Interview Question
Software Engineer / DevelopersI'm trying to make this website contains the most extensive interview questions on the web. This website was very helpful to me when I was interviewing. I just want to give something back. I'm also a moderator for this website too. If you search on blogsearch.google.com, you'll find many more interview questions from Amazon, Microsoft, and many other tech companies.
My intention for posting these interviewing questions isn't about generating discussion. I just want to expose to people who are interviewing with these tech companies to a different array of questions.
I work for Amazon so I might use any of these questions any day when I interview people. So you might potentially run into them. But yes, most of them are from MS, Amazon, and Google that I found on the web. Since we're not allowed to post Google interview questions on here, I'll put it under different companies. Why do you care so much about whether I put the correct company down?
Khoa you are doing a great job!
Well no comments so far related to the shell sort code.
So i will go ahead with that.
void shellSort(int A[], int n)
{
int gap, i, j, temp;
for(gap=n/2; gap>0;gap /= 2)
{
for(i=gap; i<n;i++)
{
for(j=i-gap;j>=0 && A[j]>A[j+gap];j -= gap)
{
temp = A[j]; A[j]=A[j+gap]; A[j+gap] = temp;
}
}
}
}
The outermost controls the gap between compared elements, shrinking it from n/2 by a factor of 2 each pass until it becomes zero.
The middle loop steps along the elements.
Innermost loop compares each pair of elements that is separated by gap, and reverses any that is out of order.
Khoa,
- Daniel Johnson March 02, 2008You have posted way too many questions. Do you just put questions to generate discussion or were they really microsoft or amazon questions ?
I personally think that lot of your questions are just to generate discussion and if you put them as Microsoft or Amazon questions, the likelihood of other people taking part is high. Its a good tactics you are employing but you must be truthful at the same time.