Added _n and _n_nonempty algorithms.