Interview Question
InternsCountry: United States
Interview Type: Phone Interview
I think the collision also means when their hash value collides, which can be handle by a linkedlist storing both value and the original key.
I think the collision also means when their hash value collides, which can be handle by a linkedlist storing both value and the original key.
is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
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.
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.
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.
1. HashMap is Java's version of a Hash Table based on the Map interface. It maps keys to values using a hash function.
- kakitayuri February 01, 20132. Array list is an array with dynamic resizing and shifting, while a linked list is a set of nodes linked together. Arrays are great for accessing data an any index in constant time, but inserts require O(n-index) time, so inserting to the front of an ArrayList is linear time for EACH insert, while it's constant time in a LinkedList. However, accessing data near the middle of a LinkedList takes O(n) time because we have to travel through the nodes to get to it.
3. To my knowledge, collisions are handled internally when you put an item into a HashMap. One issue with HashMap that you won't get with a linking HashTable is that you cannot put a key to map to two different values. For example if you had a key<string> "John Smith" and you wanted 4 different phone number values for it, you could not do that with a HashMap (You can, however, have multiple keys map to a single value.)
4. Runtime Polymorphism is just what it sounds like - Polymorphism that occurs at runtime. So polymorphism basically deals with inheritance. Suppose we have Class Employee, and Subclass Lawyer. Using polymorphism we'd have:
Class Employee {
// Some stuff
}
Class Lawyer extends Employee {
// Some stuff
}
So we can say:
Employee lawMan = new Lawyer(); //right?
Doing this at runtime simply could go many ways. An example would be a method that builds Employees for you taking a string parameter, and something like:
//pseudo code
Some method (String str)
Employee emp;
if (str.equals("Lawyer"))
emp = new Lawyer();
Something like that would happen at runtime.