daily Programming: 2021 又見 BIG O
Tags: big-o, daily-programming, time-complexity, 紮馬步
就又想 要把馬步紮穩就這樣 又來看一些書了 XDD
Add the Runtime: O(A + B)
for (int a : arrA ) {
print(a);
}
for (int b: arrB) {
print(b);
}
Multiply the Runtime: O(A * B)
for (int a : arrA ) {
for (int b: arrB) {
print(a + " , "+ b);
}
}
Reference
- Gayle Laakmann McDowell, Cracking the Coding Interview, 6th Edition 189 Programming Questions and Solutions