I was going over VIM shortcuts & found the CTRL+p which acts as an autocomplete in UNIX (you know what I am saying, a dropdown list of the possible words to use, sorted by frequency of usage). It seems to detect even the most immediately typed words. How does this work in VIM? I am specifically interested in the data structures that are used for this?

Is there some indexing going on, which dynamically keeps adding new words to its index as they are typed? It has saved me tons of time off-late. By the way VIM Rocks :)