I am very new to competitive programming and to Big O notation.
public void function(int n){
for(int i = n; i > 0; i/=3){
for(int j = 0; j < i; j++){
System.out.println("Hello");
}
}
}
This is the algorithm. As far as i know about time complexity.It defines how run time gets affected from number of inputs.
So here if we take a example if 'n' is 10. The outer loop runs log n times and the inner loop runs 'i' times.
the inner loop runs relatively to 'i' not 'n'. So im a bit confused here as to how the time complexity is calculated. I think it is O(log n).Please correct me if i am wrong.
Will it be O(log n) or O (n log n) or (n^2). Please help me out with this. Thank you.