fixed error with run time complexity