rm algorithm