A strand folds back on itself and pairs bases, and as long as pairs do not cross, which is what these algorithms assume, a pair between positions i and j separates everything inside it from everything outside, so the subproblems are subsequences i..j. Nussinov's 1978 algorithm maximises paired bases with this same fill-by-length table, and Zuker's energy model, which is what ViennaRNA's RNAfold and mfold run, keeps the recurrence and swaps in thermodynamic costs. The n^3 is why folding a microRNA is instant and folding a viral genome is a batch job.