Bloomberg LP Interview Question for Financial Software Developers


Country: United States
Interview Type: Phone Interview




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

Names cannot be unique. So in the absence of another unique identifier (such as SSN or biometric data) it is not possible to avert hash collisions.

- Ashish Kaila November 23, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

i have used the following method for storing names in a hash if names are like this...siva12..rama13.etc..not sure if this is sufficient for pure names(strings)..of course not

int hash_name(char *str) {


int n=0;
int index = 0;
int ch = 0;

while(*str++) {

ch = *str & 0xFF;

if (ch >= 0 && ch <= 9) {
n = (n * 10) + ( ch -'0');
else
c = c ^ ch;

}


index= ((c ^ n) & 0xFF ) % HASHMASK;

return index;

}

- shiva cherukuri November 24, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Assuming unique names, simplest solution which works well is

int hashCode()
{
   int sum=name[0];
   for(int i=1;i<name.length;i++)
   {
      sum+=name[i]*(1<<i);
   }

   return sum;

}

- Yev August 15, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

the key means the input of hash function?

- cli22 October 09, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Decompose in base 26

- Anonymous December 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

If you assure that the Names are unique i.e then you can use trie tree and store the data in the nodes.

- Wayne November 23, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

use sufix tree... and for the collision use link list ..

- sanjay.2812 November 23, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

do u mean prefix tree?

- prasad_usc March 03, 2012 | 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