Bloomberg LP Interview Question for Financial Software Developers






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

I will go with sequential search because the dataset may not be sorted and we don't know the length of it.
- If length is known and sorted, then go for Binary search.
- If length is known and not sorted, use quick sort on the data set and binary search.

- Karthik December 13, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

what kind of functionalities does the dataset have?
if you access element outside bounds, can it be handled properly?
are the elements ordered in the dataset?
what is the retrieval method? direct indexing or something else?

- anonymousse December 02, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

it didn't get that involved because I only know a little programming, so it was more of just the general idea of how it would work. I had said binary search but couldn't figure out how to do it with no bounds. His hint was selecting bounds, but I couldn't think of way to choose bounds that would contain the required datapoint. Dataset is considered to be ordered though.

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

You can do the "inverse" of binary sort by jumping twice the distance every time and checking the data.
So start with index 1, then double it to 2, on failure check 4, then 8, then 16, etc. to narrow the range.

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

Bucket sort maybe?

- Anoy December 03, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Assumption: If index out of array the exception is caught are returns -1.

BSUnknown(A[],left,right,number)
{
while(A[right]<number && A[right]!=-1)
{
left=right;
right= right*2;
}
if(A[right]==-1)
{
while(A[right]!=-1)
right--;
}
if(A[right]>=number)
BinarySearch(A[],left,right,number)
}

- dk February 05, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Hi,
do you think you can use binary search to locate the index that doesn't return -1, instead of right-- ?

- DavidHo July 08, 2013 | Flag


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