Question: f 2 9 . Using Big - O notation, what is the worst - case running time of the following public static string f 2

f29. Using Big-O notation, what is the worst-case running time of the following
public static string f29(int N){
if (N <1){
return "";
}
ArrayList result = new ArrayList():
result.add("1");
for (int i =0; i < N; i++){
int size = result.size();
for (int j = size /2; j < size; j++){
String aset = result.get(j);
result.add( aset +"0");
result.add( aset +"1");
}
}
return result;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!