August 2020
Intermediate to advanced
508 pages
11h 53m
English
Another helpful optimization technique is to imagine what would happen if we stored our given data in an alternative data structure.
For example, we may be working on a problem where the data is given to us in the form of an array. However, reimagining that same data stored as a hash table, tree, or other data structure can sometimes reveal clever optimization opportunities.
Our using of a hash table for the magical lookup technique earlier is a specific example of this. However, we’re about to see that changing the data structure can be useful for other scenarios as well.
Here’s one example. Let’s say we’re writing a function that determines whether two given strings are anagrams of one another. ...
Read now
Unlock full access