added complexity description of the algorithm