, Volume 53, Issue 3, pp 298–313

Fast Algorithms for the Density Finding Problem


DOI: 10.1007/s00453-007-9023-8

Cite this article as:
Lee, D.T., Lin, TC. & Lu, HI. Algorithmica (2009) 53: 298. doi:10.1007/s00453-007-9023-8


We study the problem of finding a specific density subsequence of a sequence arising from the analysis of biomolecular sequences. Given a sequence A=(a1,w1),(a2,w2),…,(an,wn) of n ordered pairs (ai,wi) of numbers ai and width wi>0 for each 1≤in, two nonnegative numbers , u with u and a number δ, the Density Finding Problem is to find the consecutive subsequence A(i*,j*) over all O(n2) consecutive subsequences A(i,j) with width constraint satisfying w(i,j)=∑r=ijwru such that its density \(d(i^{*},j^{*})=\sum_{r=i^{*}}^{j*}a_{r}/w(i^{*},j^{*})\) is closest to δ. The extensively studied Maximum-Density Segment Problem is a special case of the Density Finding Problem with δ=∞. We show that the Density Finding Problem has a lower bound Ω(nlog n) in the algebraic decision tree model of computation. We give an algorithm for the Density Finding Problem that runs in optimal O(nlog n) time and O(nlog n) space for the case when there is no upper bound on the width of the sequence, i.e., u=w(1,n). For the general case, we give an algorithm that runs in O(nlog 2m) time and O(n+mlog m) space, where \(m=\min\{\lfloor\frac{u-\ell}{w_{\mathrm{min}}}\rfloor,n\}\) and wmin=min r=1nwr. As a byproduct, we give another O(n) time and space algorithm for the Maximum-Density Segment Problem.


Maximum-density segment problemDensity finding problemSlope selection problemConvex hullComputational geometryGC contentDNA sequenceBioinformatics

Copyright information

© Springer Science+Business Media, LLC 2007

Authors and Affiliations

  1. 1.Department of Computer Science and Information EngineeringNational Taiwan UniversityTaipeiTaiwan
  2. 2.Institute of Information ScienceAcademia SinicaNankang, TaipeiTaiwan