Bloomberg LP Interview Question for Financial Software Developers






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

You may use a hash table which has the advantage of the o(1) lookup time. However since we also need to find all names and phone numbers between two names the hash function should be such that h(x) should be either monotonically increasing or monotonically decreasing.

Also you may use a binary search tree which has nlogn search time complexity and the process of implementing the given operation will be easier.

- Anonymous April 08, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use a red-black binary search tree to keep all the records of contacts. The query of finding all the contacts between X and Y can be done by one pass in-order traversal, whose time complexity is linear.

- Bangxin May 12, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

i think the best way to implement a contact list with the features as now available in mobile phones, is to use a TRIE, where, say , typing m will show all contacts starting with m and say for typing ma it will show all contact starting with ma and so on .

- googler August 07, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I would also prefer TRIE for the first part but not for the 2nd part. 2nd data structure choice will depend on stats of queries. If find queries are more than insertion, Binary Search tree will be preferred.

- Anant Kumar August 20, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

wHat about using a Multimap ?

- Anonymous October 16, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Best wud be to use an associative array (built using a self-balanced AVL / Red-Black tree). An associative array supports range queries and the complexity is O(logn + m) where n = depth of the balanced tree & m = size of the range.

- Helper December 19, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

B+ tree.

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

I would use a couple of structures:
1. Storage for contacts (linear array or vector). Contact entries may be quite big if we store additional info.
2. Map for matching names to contact ids. A separate map for phone numbers to ids.
However, deleting would be a really costly operation.

- Anonymous June 08, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use a STL map, key will be name and value will be phone number
Since the key will be sorted, to get all the names between two names, you can use a find(key) which returns the iterator to that key and then we have to increment the iterator till it reaches the second given name

- San October 23, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

STL map use red-black tree internally

- nim January 23, 2012 | 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