请教下,刷题时看到要求“不要用额外空间来实现”(Could you implement it without using extra memory?) 这个是不是就等于要求空间复杂度是O(1)? 还是说不要new 任何新数组 new任何新变量?
有人说这个要求是 等于”要求空间复杂度是O(1)“。 可是一般算法空间复杂度都是O(1)吧,除非递归,递归是O(n). 这个要求提出来是不是说不要用递归?
============
Could you come up with an one-pass algorithm using only constant space?
这个怎么理解
===========
-- using memory.
-- not using any external memory. ” 这个external又怎么理解呀? 是说外部存储器?移动硬盘U盘之类的吗?
=========
Could you come up with an one-pass algorithm using only constant space? 这里的one-pass 一遍循环
是=linear的意思吗,
是=O(n)吗? 比 O(n)严格,后者 可以是 很多次循环,只要不嵌套