PhoneBook search ALgorithm

Sep 4, 2014 at 9:58pm
Hi i need to write phonebook search algorithm!if we have names
Aram
Aren
Atin
Banett
Clara
if i write A it will show first 3 than i can input r it will show onli first two etc. i want to know the fastest way to do this!
Sep 5, 2014 at 5:48am
Probably a preordered binary search. Take a look at the standard functions sort()

http://www.cplusplus.com/reference/algorithm/sort/?kw=sort

and lower_bound():

http://www.cplusplus.com/reference/algorithm/lower_bound/?kw=lower_bound
Topic archived. No new replies allowed.