const swap = ( arr, i1, i2) => {
    const tmp = arr[i1];
    arr[i1] = arr[i2];
    arr[i2] = tmp;
    return arr;