An array $A[1…n]$ is said to be k-ordered if $$A[i – k] leq A[i] leq A[i + k]$$ for all $i$ such that $k < i leq n – k$. For example, the array $A = [1, 4, 2, 6, 3, 7, 5, 8]$ is 2 ordered. Q1. In a 2-ordered array of 2n elements, what is the maximum number of positions that an element can be from it’s position if the array were 1-ordered?
a) 2n-1 b) 2 c) n/2 d) 1 e) n
Q2. In an array of 2n elements, which is both 2-ordered and 3-ordered, what is the maximum number of positions that an element can be from it’s position if the array were 1-ordered?
a) 2n-1 b) 2 c) n/2 d) 1 e) n
I can understand how the example array is two ordered, but I am having trouble understanding what the questions 1 and 2 are trying to say. Can someone please explain to me the meaning of the questions in simple terms? Thanks! P.S. First time questioner here. Sorry if I missed anything.
Asked By : Gaurang Tandon
Answered By : Yuval Filmus
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/25839