Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Time Complexity

801437Dec 3 2009 — edited Dec 3 2009
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!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 31 2009
Added on Dec 3 2009
4 comments
241 views