Also, check out the Appendix to Chapter 5 of Card, Moran, & Newell (1983) "The Psychology of Human-Computer Interaction." The approach is basically a dynamic programming algorithm that attempts to minimize a cost function that grows with the degree of sequence mismatching. The idea is very general.