NetApp Interview Question for Analysts


Team: Bigdata analyst
Country: India
Interview Type: In-Person




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

The question does not make sense if the point is to have "abc" and "ABC" mapped to different hash values. It already does that by default.

If the point was to consider "abc" and "ABC" as the same key, we would have to override the hashCode() and equal() of the type we're putting in the HashMap.
This would make more sense as an interview question.

- Miguel Oliveira August 31, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

HashMap's put() and get() methods utilize the hashCode() and equals() function. Note that 'abc' and 'ABC' are distinct separate values. As such, the hashCode(abc) and hashCode(ABC) will result in different key values.

On the other side, let's say that we have a key collision and we're trying to retrieve a case sensitive value from the resulting LinkList that is created at that bucket entry. Then the .equals(abc) and .equals(ABC) can clearly distinguish what value you are seeking.

- masterjaso August 31, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

consider the string str[]="abAcD"

and if this should be hashed to the string str[]="abacd"

then toupper(str[i])-'a' would give the same result for both of them .

- ram rs September 10, 2013 | 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