The algorithm increases gas efficiency by consolidating swap steps, which reduces overall transaction costs.