Bank of America Interview Question for Software Engineer / Developers






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

How about catching memory exception?

- Map September 28, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

if it's not sorted anymore.

- VM November 12, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Why would map be sorted in the first place ? Its a key value association

- abhimanipal May 07, 2010 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

It is sorted in C++ STL (implemented as a tree), unlike HashMap. The tree structure wouldbe corrupted if you get the reference to the key and override it by brute force. Then the tree search will stop at the node even if the searched element is in the tree (i.e. at the subtree which has the parent with overridden key as a parent).

- ewolfson June 17, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

map will be corrupted when you have one key references two values. A map should always have a unique key for each value.

- the messiah January 09, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

But how can you make a key to reference two values?

- Surendar January 09, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

If you change the Hashcode logic for a key

- Nanjundan Chinnasamy April 01, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

In case of Java HashMap, corruption is easy to occur if you use it in multi-threaded application without synchronization between threads.

The HashMap has bucket (represents a hash value) and an array representing the list of items that correspond to the given hash value.

{0} -> [x] -> [y] -> null
{1} -> [a] -> null

A common scenario of a corrupted HashMap looks like this:
{0} -> [x] -> [y]
<-

That is, [x] has [y] as its next element and [y] has [x] as its next element. This causes an infinitely loop if you traverse the list.

- kredible February 16, 2018 | 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