Sequence comparison. You may want to compare two sequences to know how similar (or dissimilar) they are. One
way of doing this is to find the longest subsequence the two have in common (longest common subsequence) or to
find the minimum number of basic edit operations to go from one sequence to the other (so-called edit distance, or
Levenshtein distance). These two problems are more or less equivalent; see Chapter 8 for more information.
Sequence modification. Inserting an element into the middle of a linked list is cheap (constant time), but finding a
given location is costly (linear time); for an array, the opposite is true (constant lookup, linear insert, because all later
elements must be shifted). Appending can be done cheaply for both structures, though (see the “Black Box” sidebar
on list in Chapter 2).
Do'stlaringiz bilan baham: |