The current code complexity when looking up the position of a word in the frequency list is O(n).
This operation is done one per card to analyze. The new code changes this complexity to average O(1). This will result in a much faster update of cards for a large frequency list.
The implementation is simply replacing a list lookup with a dictionary lookup.
The current code complexity when looking up the position of a word in the frequency list is O(n). This operation is done one per card to analyze. The new code changes this complexity to average O(1). This will result in a much faster update of cards for a large frequency list.
The implementation is simply replacing a list lookup with a dictionary lookup.