# What is the probability that if n =39 a randomly chosen array element is in A[$\lfloor n/2 \rfloor$], A[$\lfloor n/2 \rfloor$ + 1], . . . , A[n]?

"A sample space is the set of all possible outcomes of a random process or experiment. An event is a subset of a sample space" For any finite set A, N(A) denotes the number of elements in A.

Suppose $A[1], A[2], A[3], . . . , A[n]$ is a one-dimensional array and $n ≥ 50$.

a. How many elements are in the array?
b. How many elements are in the subarray
$A[4], A[5], . . . , A[39]$?
c. If $3 ≤ m ≤ n$, what is the probability that a randomly chosen array element is in the subarray $A[3], A[4], . . . , A[m]$?
d. What is the probability that a randomly chosen array element is in the subarray shown below if n = 39?
$A[\lfloor \frac n2 \rfloor], A[\lfloor \frac n2 \rfloor + 1], . . . , A[n]$

Source: Discrete Mathematics with Applications Susanna S. Epp I'm not sure about my answer for d. Can you show how to solve the question d?

a. $n$
b. $36$
c. $\frac {m-2}n$
d(edited).

$A[\lfloor \frac {39}{2} \rfloor]=A[19], A[\lfloor \frac {39}{2} \rfloor + 1]=A[20], . . . , A[39]$ has 39-18=21 elements

So $\frac {21}{39}$

I too think you might have made a mistake. Firstly, there is no $m$ or infact, no variable in the question.. unless the question was -

What is the probability that a randomly chosen array element is in the subarray shown below if $m = 39$? $A[\lfloor \frac m2], A[⌊\frac m2⌋ + 1], . . . , A[m]$

If so, then the answer would be-
$⌊\frac m2⌋= 19$ and so, there are $21$ elements.

The probability would then be $\frac {21}n$

If the original question is right though, then the answer would be -

$\frac {21}{39}$ putting $n=39$ above.

• There are 39-18=21 elements in an array A[39], ..., A[$\lfloor \frac {m}{2} \rfloor$ + 1 = 20] A[$\lfloor \frac {m}{2} \rfloor$ = 19] Mar 7, 2016 at 8:34
• @buzzee Thank you. Edited. Anyway, you already got it. Mar 7, 2016 at 12:42