1. An algorithm for a handheld device for selecting a subexpression of a mathematical expression having a visible representation displayed on a screen on the handheld device, the algorithm comprising: selecting an expression string of the handheld device; converting the string to a contiguous tokenized Polish representation (CTPR) of the expression, wherein at least one operator of the CTPR is binary; and loading the CTPR of the expression into an n-ary tree, wherein the user may navigate within the visible representation of the expression to select a subexpression, wherein the handheld device is adapted to select the subexpression from the n-ary tree.