Whether using a mechanical switch or an electronic switch, the microcontroller only needs to check if the button is pressed at a specified speed. If two or more consecutive zeros are detected, this indicates the end of a character, and then the table lookup can be performed to match the entered character. For processors with 100 MHz, this calculation is negligible. Furthermore, the binary tree is not a complete tree, and the leaf nodes containing symbols are empty. If you really want to focus on speed, create an index sorted by the code table, use the middle value method for fast lookup, and the efficiency should exceed recursive retrieval of the tree.