Hash Table
April 26, 2024
1 min
Big O notation describes the complexity of an algorithm as a function of the size of an input. How quickly an algorithm will likely run based on the number of inputs passed into it.
O(n) runtime ⇔ execution time grows linear as the input’s size. when passing input with size 5, it will take 5 times longer than input with size 1
print("Hello World") => O(1)x = 1if 100 == 100:print(x)
sum = 0for e in A:sum += e
for(int i = 0; i < n+10; i++) {for(int j = 0; j < m; j++) {cout<<”Hello world”<<endl;}}
public static int sum(int k) {if (k > 0) {return k + sum(k - 1);} else {return 0;}}
// O(logn)def intToStr(i):digits = '0123456789'if i == 0:return '0'result = ''while i > 0:result = digits[i%10] + resulti = i/10return result
def fact_recur(n):if n <= 1:return 1else:return n*fact_recur(n – 1)O(n)
Quick Links
Legal Stuff
Social Media