Ebay Interview Question for Member Technical Staffs


Country: United States
Interview Type: Phone Interview




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

I'm thinking :

An array (array is not part of Collections) to store all the terms. Keep the array sorted.

An array of linked lists to store the definition. Each term is mapped to an index in the array which stores a linked list of its definitions. To do the mapping, you can device a hash function.

- greenwizard April 17, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think Trie Data Structure should work here.
Source : Wikipedia

Insert
=======

algorithm insert(root : node, s : string, value : any):
node = root
i = 0
n = length(s)

while i < n:
if node.child(s[i]) != nil:
node = node.child(s[i])
i = i + 1
else:
break

(* append new nodes, if necessary *)
while i < n:
node.child(s[i]) = new node
node = node.child(s[i])
i = i + 1

node.value = value


Output all keys in the trie by means of pre-order traversal, which results in output that is in lexicographically increasing order

- dsshah22 April 21, 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