Morgan Stanley Interview Question for Software Engineer / Developers






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

1. linear look up this word.
2. is that saying that it is a least square regression problem?
3. make the bigger set a tree. query each item of set2 in that tree so the complexity is nlogn.

- rp March 15, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

do u mean frequency of a particular/given word like a search string, or frequencies of all words in the dictionary?

- vel March 22, 2007 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Frequencies of all the words

- Srinivasan April 02, 2007 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

RP-
You can do it in linear time... Think of hashing

- Srinivasan April 02, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

preprocessing in hashing will be more expensive if you need to find just one word.

- Anonymous February 05, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Doesn't matter, you still have to do hashing, because it can be ANY word. So you have to run through the entire book or file for all the words. So you can just hash it once and 'cache' it or put the hash recorded structure in another file so if user use it again, it will be fast the 2nd time. It's mostly going to be slow the first time as with MOST THINGS in life.

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

Can be done in linear time using Boyer's Moore algorithm. If preprocessing is allowed we can build a hash table and keep a count of all the words seen in the book but that will be expensive. We can also use suffix tree which can be constructed in O(n) time and will require the same amount of space and then the search for the pattern can be carried out in O(length of pattern). But this will also take a lot of space. Can anyone think of a better solution????

- gauravk.18 March 01, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

u can use parallel programming to build the map. Its like divide the book to pages and then start a job to build a hashmap of words for those page range. Then after running all of the hashing paralley, we can aggregate all the maps.

- susanta May 18, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Using trie data structure we can build the entire book. Then search for the work in O(n) time. Storing or preprocessing is must, other on_the_fly solutions won't scale.

- Daniel Johnson January 09, 2011 | 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