hyunsik-yoon / Data-Structures-and-Algorithms

Apache License 2.0
1 stars 0 forks source link

Things to remember #1

Open hyunsik-yoon opened 1 year ago

hyunsik-yoon commented 1 year ago

Let's write them down.

hyunsik-yoon commented 1 year ago

Big O

func(arr1, arr2) {
   foreach arr1 ...
   foreach arr2 ...
}

Big O of the above is O(n+m) since we don't know if n is dominant or m is dominant.

Likewise,

func(arr1, arr2) {
   foreach arr1 ...
      foreach arr2 ...
}

Big O of the above is O(n*m)