Backend code for bitonic sorting