title: How can I reorder a list?
body: <p>Given an arbitrary array of size <code>n</code>, I'd like to reorganize the elements of the array based on the array's discrete indices.</p>
  <p>Python example:</p>
  <pre class="lang-py prettyprint-override"><code># Unique array of size n
  [ &quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;, ... &lt;n&gt; ]
  
  # Indices of array
  [ 0, 1, 2, 3, 4, ... &lt;index_of_n&gt; ]
  
  # Desired re-organization function 'indexMove'
  indexMove(
      [ &quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;, ... &lt;n&gt; ],
      [ &lt;index_of_n&gt;, 4, 0, 2, 3, ... 1 ]
  )
  
  # Desired output from indexMove operation
  [ &lt;n&gt;, &quot;e&quot;, &quot;a&quot;, &quot;c&quot;, &quot;d&quot;, ... &quot;b&quot; ]
  </code></pre>
  <p>What is the fastest way to perform this operation (achieving the smallest time complexity)?</p>