implemented multidim quick sort