Sorting an array based on another array
<p>I have two lists</p>

<p>A=[5,2,3,4,1]</p>

<p>B=[3,1,5]</p>

<p>I want to sort B using A such that the output reflects:
[5,3,1]</p>

<p>How can I implement this? Thanks.</p>
