Questions
- Identify the best/most appropriate from the data structures covered in this chapter concerning the following use cases:
- Mapping items to another set of items (set being used in the most general sense)
- Accessing, modifying, and appending elements
- Maintaining a collection of unique elements
- Keeping track of the minimum/maximum of a set (in the most general sense)
- Appending and removing elements at the endpoints of a sequence (in the most general sense).
- Fast searching according to some similarity criterion (for example, being used by autocompletion engines).
- What is the difference between caching and memoization?
- Why are comprehensions and generators (in most situations) more preferred than explicit
for
loops? - Consider the problem of representing a pairwise association between a set of letters and a set of numbers (for example, a 2, b 1, c 3, and so on), where we need to look at what number a given letter is associated with in our application...