The base pair similarity score sim½s o i ðxÞ, s o j ðyÞ for the outer stems of two multi-loops can be easily obtained from the previously calculated base pair similarity scores. If the outer stem is a conserved match, a local alignment on the set of inner structure elements is used to find the base pair similarity score. Here, gaps are allowed in the local alignment of inner structure elements; however, no gap penalty is used. Let two sets of inner structure elements S i (x) ¼ [s 1 (x),. . ., s n (x)] and S j (y) ¼ [s 1 (y),. . ., s m (y)] be given. Let H(i, j) be the maximum similarity score between a suffix of S i (x) and a suffix of S j (y). The optimal local alignment is calculated as follows: