Oracle Interview Question for Software Engineer / Developers






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

Trie.
i can make key of in the tree which is not a single key but rather 3 keys. 1 for name another for address and one more for surname

Lets say my number is 8888888 then this will be saved in Anshul as well as Zunke and also with Address. All the three will have an identifier with which attribute the number has been saved in the node i.e whether the key is as per name surname or address

- anshulzunke September 12, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Now the problem will be if the Name/Surnames are not unique.

- anshulzunke September 12, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

structure . struct in C

- Anonymous August 21, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

yup, that ought to do it. sweet

- Anonymous August 21, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

LOL

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

A range tree will do it.

- Anonymous August 21, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Need more info on the relationships between the fields - 1:n, n:1, n:n, so on.
For example, can an address have multiple phone numbers? Can a phone number belong to multiple addresses? Etc.
With that info, I believe, you'd need 3 lookup tables - one for each of the searchable fields - where each entry contains the hash key of the related fields values.

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

3 dictionary structures, one for each searchable field.

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

Actually, I think you need a fourth table with 3 fields. Each field corresponds to one of the three lookup tables

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

Kd-Tree is the data structure which will solve this problem.

- dongre.avinash August 23, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

what foolish comment. !

- Anonymous August 23, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Trie is the best data structure for phone book or dictionary

- Ashwini August 27, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use trie tree data structure...........
index the each contact based on three fields

- Anonymous August 31, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

how will trie solve this problem
How can three things searched simultaneously

- nr September 11, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Two hash tables with key as phone number as it will be unique for each person. In one table <phone number, name> and other table <phone number, address>

- Anonymous September 28, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

that might address searching by phone no. But search by address and name is still a question

- UK November 02, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

from what i think is that each node in the trie will have three fields phno, address and name. Phone number are supposed to be unique so we can search the ph no to get to the node and then have the address and the name.

So, in short trie data structure on ph no.

- Anonymous November 23, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

They want it to be searchable on any field. If given only name, what will you do?

- neer300 January 02, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

100

- onkyokebkev December 02, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

B+ tree?

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

B+ tree can help. Individual trees can be built for every attribute. Whenever a new record is created, each of the tree gets an entry. The time will be O(h*d) where h is the height and d is the degree of the internal node. All the data will be in the leaves

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

create an object with all three fields and three hash maps for storing reference corresponding to each field separately.

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

There might be 100's of millions of numbers . We need a space and time efficient solution .

Soln
a) Hash Map :::- Only Mobile number is unique, so it can work as key. Name and Address might be delimiter separated or can be part of a user defined object
Pros :- O(1) search
:- Search based on number will be used 99% of the time as it will return unique names/addresses

b) Address and Name can be searched in O(n) where n is total number of mobile numbers

eg
public class Address
{
String first Name;
String Middle Name;
String Address;
String City ……

}

HashMap< String MobileNumber,Address> = new HashMap…..

Benefits, Search on even last name can be done…

- Tarun Aggarwal June 17, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Store the name, phone number,address in an object. Have an arraylist of many such objects. Now, if we want to search by name, sort the arraylist by name(O(nlogn)) and we can do seach in logn time. Similarly for address and phonenumber

- Vathul August 16, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

{{
#!/usr/bin/env python
# Jorge Niedbalski <jnr@pyrosome.org>

class Query:
(c,d) = ([],[])

def __init__(self):
pass

def a(self, d):
self.d.append(d)
return self

def f(self, k, v):
self.c.append((k, v))
return self

def g(self):
for entry in self.d:
cc = []
for k,v in self.c:
try:
cc.append(entry[k] == v)
except KeyError:
pass
if any(cc):
yield entry

def f():
persons = Query() \
.a({'name': 'tester', 'address': 'test avenue 99'})\
.a({'name': 'tester1', 'address': 'test avenue 100'})\
.a({'name': 'tester2', 'address': 'test avenue 101'})\
.f('name', 'tester').g()

for person in persons:
print person

f()

}}

- niedbalski November 06, 2013 | 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