attributed median algo