Answer:
(11n-5) / 12 is correct answer.
Explanation:
The Probability that key will match to nth term = 1/2
The Probability that key will match to n-1th term = 1/3
As all other probabilities are equal
The Total Probability that key matches to any of 1 to n-2 index = 1 - 1/2 - 1/3 = 1/6
The Probability that key matches to any of 1 to n-2 index = (1/6) / n-2 = (1/6)* (n-2))
Let P(i) = Probability that key matches to ith index.
The Average time complexity = 22 i=1 P(i) * i
The Average time complexity = 1/(6(n-2) * ( sum of 1 to n-2 ) + (n-1) / 3 + n/2
The Average time complexity = 1/(6(n-2) * ( n-2)*(n-1) / 2 + ( n-1) / 3 + n/2
The Average time complexity = 1/6 * (n-1)/2 + (n-1)/3 + n/2
The Average time complexity = (n-1)/12 + (n-1)/3 + n/2
The Average time complexity = (n-1 + 4 * n - 4 * 1 +6 * n)/12
The Average time complexity = 11n-5 / 12
so (11n-5) / 12 is correct answer.
False.
The different between break and continue instruction is that with break you exit the loop, and with continue you skip to the next iteration.
So, for example, a loop like
for(i = 1; i <= 10; i++){
if(i <= 5){
print(i);
} else {
break;
}
}
will print 1,2,3,4,5, because when i=6 you will enter the else branch and you will exit the loop because of the break instruction.
On the other hand, a loop like
for(i = 1; i <= 10; i++){
if(i % 2 == 0){
print(i);
} else {
continue;
}
}
Will print 2,4,6,8,10, because if i is even you print it, and if i is odd you will simply skip to the next iteration.
1. go back to the feedback you submitted
2.Locate the order, and then click remove
3.select a reason for the removal and click to remove the feedback button.
(But why would you write a rude comment in the first place to begin with?)
It stands for Electronic Business, a typical example of this is a online store.