Question: Consider the following method: public a ( String s ) { int v = 0 ; for ( int x = 1 ; x <

Consider the following method:
public a(String s){
int v =0;
for(int x =1; x < s.length; x=x+1){
if(s[x]=='a'|| s[x]=='e'|| s[x]=='i'|| s[x]=='o'|| s[x]=='u'){
v = v +1;
}
}
return v;
}
Exactly how many lines of code (statements) are executed by the method a() in the worst case? Express your answer in terms of n, the length of the string s.

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!