For each of the following functions, give its big-O time complexity and explain why.
void function1(int n) {
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
cout << "*" << endl;
}
}
}
void function2(int n) {
for (int i = 1; i <= n; i *= 2) {
cout << "*" << endl;
}
}
void function3(int n) {
if (n == 0) return;
function3(n - 1);
function3(n - 1);
}
void function4(int n) {
if (n == 0) return;
for (int i = 0; i < n; i++) {
cout << "*" << endl;
}
function4(n / 2);
function4(n / 2);
}