~~~ 𝑻𝒉𝒆 π‘Ίπ’†π’“π’Šπ’†π’” 𝒐𝒇 π‘©π’Šπ’ˆ 𝑢 ~~~𝑷𝒂𝒓𝒕 – 𝑰𝑰

double temp = power(x, n / 2);
if (n % 2 == 0) {
return temp * temp;
} else {
return x * temp * temp;
}
while (b != 0) {
int temp = b;
b = a % b;
a = temp;
}
for (int i = 1; i <= n; i *= 2) {
// Some constant-time operations
}
while (n > 1) {
// Some constant-time operations
n = n / 2;
}
for (int i = 1; i <= n; i *= 2) {
for (int j = 1; j <= i; j++) {
// Some constant-time operations
}
}


Leave a Reply