Does Big O Measure Memory Requirments Or Just Speed?

前端 未结 8 1758
孤城傲影
孤城傲影 2021-02-18 16:08

I often here people talk about Big O which measures algorithms against each other

Does this measure clock cycles or space requirements.

If people want to contras

8条回答
  •  不思量自难忘°
    2021-02-18 16:38

    If someone says "This algorithm runs in O(n) time", he's talking about speed. If someone says "This algorithm runs in O(n) space", he's talking about memory.

    If he just says "This algorithm is O(n)", he's usually talking about speed (though if he says it during a discussion about memory, he's probably talking about memory).

    If you're not sure which one someone's talking about, ask him.

提交回复
热议问题