implement son algorithm