algorithm estabilish