Re: help with interview question
- From: trkrishnan@xxxxxxxxx
- Date: 23 Feb 2007 20:40:53 -0800
We can build two hash tables , one for lookup with phone number and
another for name.
May be you can try a hastable with N buckets where N is a positive
integer.
Each bucket will hold a AVL tree. Phone number will be used as key
for building AVL tree.
If you are going to lookup only on phone number (say P) then a
probable hash function will be:
P % N.
Then node containing phone number P will be stored in AVL tree located
at the index P % N.
You can have another hash table with M buckets. Each bucket will hold
a AVL tree.
Name should be used as key to build the AVL tree. This hashtable will
be used to do lookup by name.
Same structure information (like person,name, phone number ) will be
used for referencing in both the Hashtables/AVL tree
combination.
Can some one please comment out on the drawbacks of the above
algorithm,
- Krishnan
.
- References:
- help with interview question
- From: new_dude
- Re: help with interview question
- From: Radoslaw Hofman
- Re: help with interview question
- From: new_dude
- Re: help with interview question
- From: Radoslaw Hofman
- help with interview question
- Prev by Date: On the General Construction for Kleene star in Context-Free Language
- Next by Date: Re: "Size Balanced Tree" - more efficient than any known algorithm?
- Previous by thread: Re: help with interview question
- Next by thread: Questions about quantum complexity theory.
- Index(es):
Relevant Pages
|