Re: Microsoft Interview Questions
- From: Ben Pfaff <blp@xxxxxxxxxxxxxxx>
- Date: Sat, 20 Jan 2007 16:50:03 -0800
"Le Chaud Lapin" <jaibuduvin@xxxxxxxxx> writes:
Of course no one can read the mind of the Microsoft person who posed
the question, but I would think that the "no sorting allowed"
stipulation would be to prevent the candidate from sorting the numbers
in a fixed array, then doing a scan, which would yield O(n).
[...]
But if this is for a "regular" engineering position instead of
research, I would imagine that the purpose of the question would be to
probe the candidate to test familiarity with standard data structures
for implementing sets [the kind that Ben Pfaff have done so much work
with. :)]. If the candidate mentions binary tree/O(nlogn) without
asking about the order of extraction from source set of the numbers,
that would be not as good an answer as saying "I do not care about the
order of extraction. I choose Red-Black or AVL tree", in which case
O(nlogn).
That's an interesting suggestion, but I would have, personally,
guessed that the stipulation "no sorting" applied to other
methods that are equivalent to sorting. The construction of any
kind of binary search tree falls into that category, seeing as
a sorted array can be derived from the BST in O(n) time.
--
Ben Pfaff
blp@xxxxxxxxxxxxxxx
http://benpfaff.org
.
- Follow-Ups:
- Re: Microsoft Interview Questions
- From: Le Chaud Lapin
- Re: Microsoft Interview Questions
- References:
- Microsoft Interview Questions
- From: kool_guy
- Re: Microsoft Interview Questions
- From: Chris Smith
- Re: Microsoft Interview Questions
- From: Le Chaud Lapin
- Microsoft Interview Questions
- Prev by Date: Re: Microsoft Interview Questions
- Next by Date: Re: Graph Coloring
- Previous by thread: Re: Microsoft Interview Questions
- Next by thread: Re: Microsoft Interview Questions
- Index(es):
Relevant Pages
|