八歲大O? [複製] - Big-O for Eight Year Olds? [duplicate]

問題:

This question already has answers here : 這個問題在這裏已經有了答案
Closed 4 years ago . 4年前關閉。

I'm asking more about what this means to my code.我在詢問更多關於這對我的代碼意味着什麼。 I understand the concepts mathematically, I just have a hard time wrapping my head around what they mean conceptually.我從數學上理解這些概念,我只是很難理解它們在概念上的含義。 For example, if one were to perform an O(1) operation on a data structure, I understand that the number of operations it has to perform won't grow because there are more items.例如,如果要對數據結構執行 O(1) 操作,我知道它必須執行的操作數量不會增加,因爲有更多項目。 And an O(n) operation would mean that you would perform a set of operations on each element.並且 O(n) 操作意味着您將對每個元素執行一組操作。 Could somebody fill in the blanks here?有人可以填寫這裏的空白嗎?

  • Like what exactly would an O(n^2) operation do?就像 O(n^2) 操作究竟會做什麼?
  • And what the heck does it mean if an operation is O(n log(n))?如果操作是 O(n log(n)),這到底意味着什麼?
  • And does somebody have to smoke crack to write an O(x!)?是否有人必須抽菸才能寫出 O(x!)?

解決方案:

參考一: https://stackoom.com/question/RsT
參考二: Big-O for Eight Year Olds? [duplicate]
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章