Im having problems working out the time complexity of my program. The code is
LinkedList list = new LinkedList();
int number = 10;
int balls_Value = list.get(list.size()-1);
list.remove(list.size()-1);
while (number >0) {
for (int i=0;i<ball_Value ;i++ ){
int ball_Value= ball_Value / 2;
if (ball_Value > 0) {
list.add(balls_Value);
}
}
I understand that i need to work out the while look which occurs in this case +1 times if the value worked out in the for loop. I've read through lots of notes etc and still cant work it out. Any help of how to will be appreciated!