Given the following statement:
"A nonempty array A consisting of N integers is given. Any integer K, such that 0 ≤ K < N-1, splits array A into two non-empty parts"
What does the 0 ≤ K < N-1 expression mean in this context?
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.
Sign up to join this communityGiven the following statement:
"A nonempty array A consisting of N integers is given. Any integer K, such that 0 ≤ K < N-1, splits array A into two non-empty parts"
What does the 0 ≤ K < N-1 expression mean in this context?
You have an array with indices from $0$ to $N-1$. $K$ is an in integer in this range, i.e. larger or equal to zero and smaller than $N-1$.
This integer splits the array into two parts as follows:
Part 1: From $0$ to $K$ (including K)
Part 2: From $K$ (excluding K, i.e. starting with $K+1$) to $N-1$.
$K$ has to be smaller than $N-1$ (and not smaller or equal) because else there would only be one Part (the whole array) for $K= N-1$.