Differences between time complexity and space complexity?

后端 未结 7 2303
北荒
北荒 2020-12-12 10:04

I have seen that in most cases the time complexity is related to the space complexity and vice versa. For example in an array traversal:

for i=1 to length(v)         


        
7条回答
  •  长情又很酷
    2020-12-12 10:29

    The way in which the amount of storage space required by an algorithm varies with the size of the problem it is solving. Space complexity is normally expressed as an order of magnitude, e.g. O(N^2) means that if the size of the problem (N) doubles then four times as much working storage will be needed.

提交回复
热议问题