常数时间

计算复杂度理论中,常数时间是一种时间复杂度,它表示某个算法求出解答的时间在固定范围内,而不依照问题输入数据大小变化。

常数时间记为(采用大O符号)。数字1可以替换为任意常数。

举例:

想在「访问数组上的元素」的问题上达到常数时间,只要以元素的访问即可。
然而「在数组上搜索最小值」并不是一个常数时间问题,因为这需要扫描数组上的每一个元素以寻找最小值及其位置,一般需要次访问。

参考文献

书籍

  • Arora, Sanjeev; Barak, Boaz, , Cambridge, 2009 [2018-01-19], ISBN 978-0-521-42426-4, Zbl 1193.68112, (原始内容存档于2021-03-20)
  • Downey, Rod; Fellows, Michael, , Berlin, New York: Springer-Verlag, 1999
  • Du, Ding-Zhu; Ko, Ker-I, , John Wiley & Sons, 2000, ISBN 978-0-471-34506-0
  • Template:Garey-Johnson
  • Goldreich, Oded, , Cambridge University Press, 2008 [2018-01-19], (原始内容存档于2021-11-08)
  • van Leeuwen, Jan (编), , MIT Press, 1990, ISBN 978-0-444-88071-0
  • Papadimitriou, Christos, 1st, Addison Wesley, 1994, ISBN 0-201-53082-1
  • Sipser, Michael, 2nd, USA: Thomson Course Technology, 2006, ISBN 0-534-95097-3

研究报告

参见

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.