Traditional algorithm (1)