Your reason for not using a hash table is not true based on the limited information in your question at present. It is quite effective if used well. It may also have the advantage of not wasting memory saving duplicate strings if this is acceptable for your needs, which further reduces memory consumption if duplicate strings are possible.
Perhaps you can also store the concise form of each row in a hash table if you were oriented on how you perform the search. How many lines are usually?
source
share