I want to implement a search filter that is as efficient as possible, that manages book titles in my "library". The search should work as follows:
The user types in the first b letters of the book title. will be returned Number n of book titles that begin exactly with the entered sequence of letters. k is one preset constant that specifies how many book titles should be output. That means if n ≤ k, an alphabetically sorted list of the n book titles is output.
The main problem I'm currently facing is that I don't know what datatype to pick and on what data structure I should implement it because I need it as efficient as possible.
And a follow up question would be, if I use an array for this, I would definitely choose an sorted array right?
Any help is gladly appreciated an I'm NOT asking for an implementation.