Sparse RNA folding: Time and space efficient algorithms

Rolf Backofen, Dekel Tsur, Shay Zakov, Michal Ziv-Ukelson

Research output: Contribution to journalArticlepeer-review

42 Scopus citations


The currently fastest algorithm for RNA Single Strand Folding requires O(nZ) time and Θ(n2) space, where n denotes the length of the input string and Z is a sparsity parameter satisfying n≤Z<n2. We show how to reduce the time and space complexities of this algorithm in the sparse case. The space reduction is based on the observation that some solutions for sub-instances are not examined after a certain stage of the algorithm, and may be discarded from memory. The running time speed up is achieved by combining two independent sparsification criteria, which restrict the number of expressions that need to be examined in bottleneck computations of the algorithm. This yields an O(n2+PZ) time and Θ(Z) space algorithm, where P is a sparsity parameter satisfying P<n≤Z≤n(P+1). For the base-pairing maximization variant, the time complexity is further reduced to O(LZ), where L denotes the maximum number of base-pairs in a folding of the input string and satisfies L≤n\2. The presented techniques also extend to the related RNA Simultaneous Alignment and Folding problem. For an input composed of two strings of lengths n and m, the time and space complexities are reduced from O(nmZ̃) and Θ(n2m2) down to O(n2m2+P̃Z̃) and Θ(nm2+Z̃) respectively, where Z̃ and P̃ are sparsity parameters satisfying P̃<nm≤Z̃< nm(P̃+3). A preliminary extended abstract of this work previously appeared in Backofen et al. (2009) [5]. Code implementations (in Java) may be downloaded from:

Original languageEnglish
Pages (from-to)12-31
Number of pages20
JournalJournal of Discrete Algorithms
Issue number1
StatePublished - 1 Mar 2011


  • Dynamic programming
  • RNA folding
  • Space complexity
  • Sparsification
  • Time complexity

ASJC Scopus subject areas

  • Theoretical Computer Science
  • Discrete Mathematics and Combinatorics
  • Computational Theory and Mathematics


Dive into the research topics of 'Sparse RNA folding: Time and space efficient algorithms'. Together they form a unique fingerprint.

Cite this