What does “in constant time” imply?

后端 未结 8 1462
梦谈多话
梦谈多话 2021-01-30 17:21

I work as a programmer, but have no computer science background, so recently I\'ve been following along with the excellent MIT OpenCourseWare intro to Computer Science and Progr

8条回答
  •  爱一瞬间的悲伤
    2021-01-30 17:38

    If the program runs forever, then it doesn't complete in a known amount of time, because it doesn't complete. We are applying the concept of "constant time" to the run of the entire program, not to each individual step.

    "constant time" means "time not depending on the amount of input".

提交回复
热议问题