Citigroup Interview Question for Java Developers


Team: Risk Management/CMOT
Country: India
Interview Type: In-Person




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

Use Tree Data Structure

- Vaibhavs January 11, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

What kind of lookups will be required? A directory is usually implemented using something like a B tree, but depending on your application, you may also go for self-balancing trees/treaps etc. If you're simply looking for an alternative to a dictionary, then you can consider using a trie, or hashing.

- copyconstructor January 11, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Use hashing and store the whole dictionary in a binary tree...
every word will create a unique hash code and based on code store and retrieve the meaning (stored in leaf element).

Ex: hash code for a: 00000, b:00001... n:01101, ... z: 11010
Hash code for word 'an': 0000001101

In the binary tree traverse left if its 0 and 1 for right.

- Laks January 11, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

Create a Trie out of the dictionary. Search time will be O(c) where c is the number of letters in the word which you want to find regardless how many words is in the dict.

- thelineofcode January 11, 2014 | 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