134
PART 2
Understanding the Need to Sort and Search
attractive to developers. The fact is that no perfect search strategy exists, but the
exploration for such a method continues.
The final section of the chapter looks at hashing and dictionaries. The use of
indexing makes sorting and searching significantly faster but also comes with
trade-offs that you need to consider (such as the use of additional resources). An
index is a kind of pointer or an address. It’s not
the data,
but it points to the data,
much as your address points to your home. A block-by-block manual search for
your home in the city would be time consuming because the person looking for
you would need to ask each person at each address whether you’re there, but find-
ing your address in the phone book and then using that address to locate your
home is much faster.
Do'stlaringiz bilan baham: