Assuming that prefix matches are desirable, I would suggest using Patricia trie. Assuming the name and phone number can never collide - i.e. You will not have anyone with the name 435-9876 in your directory - then you can insert pairs with an indexed phone number in trie, as well as with pairs indexed by name. If, for some strange reason, names and numbers may collide, you can add a special character to prefix the phone numbers so that they might collide.
Insertions will cost O (s)
Search will cost O (s)
where s is the length of the search string / inserted key.
Linux, , , , , .
EDIT:
. trie , , patricia trie , , , .
, Jane Jamie , trie, - "Ja", , , "Jan", , node "Jane", , , "Jam", .
[2]
n m
'Jane' 'Jamie'
,
[2]
n m
'Jane' [3]
e i
'James' 'Jamie'
Jamelia
[2]
n m
'Jane' [3]
e i
[4] 'Jamie'
l s
'Jamelia' 'James'
. , . , , , , 2 s, n m, , . , , , , . . node [3]. node, Jam . , [3], . , , , , "Jam" .
, s, , , s, , . , , , node .
java- , ++ .
, , . , , ! - , .