Bloomberg LP Interview Question Financial Software Developers




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

Maybe they wanted to check what kind of questions to ask given such a simple requirement.

Also, there is a glitch in the implementation of Binary Search, specially when we do
mid = (low + high)/2
If the numbers are really large, the sum of (low + high) would overflow and cycle to a negative number.
One work around is to use
mid = low + (high - low)/2

HTH,
Chander

- Chander Shivdasani on February 04, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

There is a one time cost of O(nlogn) to sort the numbers. But if the search is to be carried out frequently then the cost of each search will be O(n) if the list is not sorted as opposed to O(log n) if the list is sorted

- abhimanipal on January 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

sort and binary search

- GekkoGordan on February 03, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Could it be this easy??

- ninghsu267 on February 04, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Why not use a Hash?
Is using external memory a case?
Hash will give you the number at one shot

- Ajay Singh on February 04, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Ajay, What do you mean by 'use a Hash' ? Did you want to hash the numbers in the stream ? Or, use a Hashtable? How does either help you in the case of a very large set of numbers?

- Anon on February 19, 2011 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

If you sort and binary search, the time complexity is O(NlogN), which is not better than the linear search O(N). Hence, you can't use sort.

- Zhengli Sun on April 24, 2011 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book walking you through 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