Directi Interview Question for Software Engineer / Developers






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

Implement a dictionary ADT efficiently.
Since all hash functions are not perfect hashes, there will few inputs which are mapped to same hash values. This is Collision.
2 ways - Open Hashing & Closed Hashing. Open Hashing - create a bucket list for every collision entry. Closed hashing finds the next free spot in the Hash table.
If you want operations involving any ordering among elements - min, max, predecessor or successor, you would use a BST. If not we can go for hash. Hashtable can also help in reducing memory as we will be avoiding the use of pointers(assuming limited collisions).
No. Hash tables have avg O(1) complexity.

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

Very Good answer

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

Q: Colliston detection techniques for HashTable

1. Open Addressing :
- Linear Probing
- Quadratic Probing
- Double Hashing

2. Separate Chaining using Linked List

Q : When should a Hash table be used and when should a BST?

Use Hashtable when you have to do single value look up like what is the phone number for person ABC (Assuming your hastable stored name as key and numbers as value pair)

Use BST when you need to work over range of data like show names of employees whose salary is above $10,000 (assuming you have BST sorted by employee salary)

- RV December 19, 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