ds-algorithm