How to I write a recursive function for split even and odd indices of array?
<p><strong>This is question for my interview.</strong></p>

<p>Write a recursive function that does the following:</p>

<p>Input: An array A of length N. N is an even number and N >= 2.</p>

<p>Output: A reordered array B. The first half of B contains A’s elements with even indices. The second half of B contains A’s elements with odd indices. Convention: the first index of an array is 0 (and thus it is an even number).</p>

<pre><code>Input 1: [4, 8, 12, 16]
</code></pre>

<p>For this array, the indices and the values are as follows:</p>

<pre><code>Index: 0, 1,  2,  3
Value: 4, 8, 12, 16
</code></pre>

<p>Thus, the output is as follows:</p>

<pre><code>Expected output 1: [4, 12, 8, 16]
</code></pre>

<p>ADDITIONAL TEST CASE</p>

<pre><code>Input 2: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Expected output 2: [1, 3, 5, 7, 9, 2, 4, 6, 8, 10]
</code></pre>

<p>TASK</p>

<p>Write a recursive function in a programming language of your choice (as if you are writing real code to be used on a production server) for the above problem
In addition to the main function, you are free to write helper functions (if needed)</p>

<p>The code should have as few lines as possible (but it should still be clear and readable)</p>

<p><strong>Note: Your recursive function must show the 'spirit' of a recursive function (not just the recursive form of a for loop)</strong></p>

<p><strong>Here is my code:</strong></p>

<pre><code>def slove(array, deep=0):
    '''para:
        array: list input.
    return: list.
    !!!Do not set value for deep!!!'''
    if len(array) &gt; 2:
        if deep &gt; 0:
            for i in xrange(0, len(array), 2):
                array[i], array[i + 1] = array[i + 1], array[i]
        left = array[0]
        right = array[-1]
        array = array[1:-1]
        array = slove(array, deep + 1)
        array.insert(0, left)
        array.append(right)
        return array
    else:
        array[0], array[-1] = array[-1], array[0]
        return array


if __name__ == '__main__':
    array = map(int, raw_input('Enter array with sep is space key: ').split(' '))
    # array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    print slove(array)
</code></pre>

<p>He said that it is wrong because I use loop in program. He is correct? So how to solve it?</p>