Adobe Interview Question for Software Engineer in Tests


Country: United States




Comment hidden because of low score. Click to expand.
5
of 9 vote

trie

- Rahul Gupta July 31, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

consider the collections API - best would be to use a HashSet

- kavitha July 31, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

+1 , TRIE . Fast searching , dictionary like indexing.

- Zee July 31, 2012 | Flag
Comment hidden because of low score. Click to expand.
2
of 2 vote

trie would be the best data structure for the real world dictionary as if hash table is used the worst case running time would be O(n) where n would be the total number of elements in dictionary but worst case time taken in case of trie is O(m) where m is the length of string
For more information please refer the following link

wikipedia.org/wiki/Trie

- chescho August 08, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

It should be hashtable right?

- lovelyvikas August 01, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This question is ambiguous... I would ask the interviewer what does he mean by real world dictionary... A real world dictionary may need O(1) access, in which case it will need HashMap for implementation (I would not go for hashtable, because atleast in java.. hashtable do not allow concurrent access, not even for read, and in dictionary we do not need to modify it that often, so we should use hashmap, such that concurrent read access are allowed, and when we need to modify it, we can use synchronized methods to achieve that).

Or if my real world is fine with o(log n) access time, then we can use trie. Also to keep in mind tries are used for substring search rather then dictionary, though it could be extended to the dictionary concept.

- siddharthgupta.1986 August 01, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

i think trie supports constant access time not logn. let me know if i m wrong

- Anonymous August 01, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use hashset with chain in the buckets.Keep N buckets where N is less than total words in dictonary.For each bucket use a list (appearing as chain ).For insertion of key 1) get hash of the key.2)Apply compression to hash as hash mod N to keep hashcode under N.3)traverse the chain in the bucket nth .4) then add entry(key,value) to the chain.

- laxmi August 02, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Try Skip list. Its better then any Data Structure that uses Tree like structure

- acube August 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Skiplist takes (nlogn) space and searching will require O(logn).

where as try require < O(n) space and searching is O(k) where k is the length of the word.
Avg word length is usually between 6-12 where as no. of words in English dictionary is over 10 lacs so O(nlogn) is much greater than O(K) (near about constant).

- varun July 11, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Trie DS is the answer.
this question is asked to my friend and he answered this and got selected.

- Sha August 24, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I would have asked interviewer.

1. what do he intend to store in the dictionary? (English words, Names, Phone Numbers etc)
2. How many elements will be there in dictionary?
3. What all operations he want to perform with the dictionary? (Search by complete element, search words with prefix and so on.)
4. For which device he want to use this dictionary? (cell phone, PC etc).

1. Lets suppose dictionary is for words in english language.
2. There are over 10 lacs of words making a hashmap will lead to collision and cost of resolving collision will be greater as compare to cost of searching which will be O(1) for hashmap and O(k) for TRIE (k = 6-12) hashmap -1 TRIE +1.
3. We want our search to display all words with mentioned prefix. hashmap again -1 TRIE +1.
4. Lets say we want to store the dictionary on cell phone , then memory available is limited and storing 10 lacs of word in hashmap and keeping them all in memory is not a feasible soultion. hashmap -1 TRIE+1.

- varun July 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Regarding point 4 : Trie takes more space than hashMap...

- Sivakumar Ulaganathan September 11, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Trie plus Hash table,
Trie to organize words in sorted manner, and once get word, use that as key into hash table

- krutik January 30, 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