approach algorithm