There is no standard way, many grids/lists implement this in different ways and it drives me bonkers. Some only search on the first letter, some search on multiple letters without indicating which ones, others show a (non-modal) window that shows which letters it is currently using, others keep this buffer hidden and use a timeout to reset, other don t reset at all or with a (hidden) key like esc.
From the way you phrase your question it sounds like a simple jump to first row that starts with the pressed char - which is the simplest use case, and I fail to see what the algorithm in this case should do.
If there is a specific application you want to mimic I think you should provide a detailed description of its behavior. Although I think that after making this description, the algorithm will be peanuts.