Various algorithm problems