Calculate the result of  algorithm