Microsoft Interview Question for Software Engineer / Developers






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

For hashtable,the date store and retrieve time is O(1).
while for BST,it is O(log2n).
But the BST is sorted while hash is not.
SO when you want to use sorted data and with little memory/time
to do it,you had better use BST

- freemail165 September 26, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think there are two trade-offs between a BST/map or a Hash Table

1) when the number of object to be inserted are relatively small
2) when need to iterate over the items inserted into your data-structure
for searching purpose
Then map/bst is preferred, since has relatively lower memory overhead
However with minor modification you can have iterators over hash table
also, but that incurs more memory overhead.

Comments welcome. :)

- arnab.banerjee.82@gmail.com September 29, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

IMHO, the most important consideration is collision in hashtable.
The worst case for collision is the whole hashtable becomes a linked list, and it is O(n) to find a value.
The 2nd consideration is the insert/delete operation. It is less expensive to insert/delete for hashtalbe than BST. So if there are a lot of insertion/delete operations, hashtable is better.

- XYZ October 03, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

A hashtable becomes a linked list when there are collisions. Same can happen to a BST if the elements come in a sorted order order. BST degenerates into a linked list.

- Anonymous October 03, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Hash Table is recommended over Binary Search Tree
- When Data is in ascending/descending order
- Insertion/Deletion are not frequently required.
- Sorted sequence is not required.
- Searching is a prevalent operation.
- When data are comparatively less. When Data is more, Hashing might require more extra location to avoid Collision.

- Ankush Bindlish October 24, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

its when u know exact matches to match not just an approximation but indeed all the matches in a string.

- Anonymous September 25, 2008 | 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