Various algorithm work