A keyword in this area is *homometric*, and a key paper this one:

Joseph Rosenblatt and Paul D. Seymour.
"The Structure of Homometric Sets."
*SIAM. J. on Algebraic and Discrete Methods*, **3**, 343-350, 1982.
(PDF download)

The precise question you pose---an algorithm---is called the *beltway reconstruction
problem* in this paper:

Skiena, Steven S., Warren D. Smith, and Paul Lemke. "Reconstructing sets from interpoint distances." *Proceedings 6th Symposium on Computational Geometry*. ACM, 1990. (ACM link). Later (much later!) published in *Discrete and Computational Geometry*. Springer. Berlin, Heidelberg, 2003. 597-631.

They provide a worst-case exponential algorithm which nevertheless runs fast under probabilistic assumptions,
and proved many variants NP-hard, but not your particular variant.
Another, later paper on this topic is below, but I don't think it settled the
1-dimensional reconstruction problem:

R.J. Gardner, P. Gritzmann, D. Prangenberg, On the computational complexity of reconstructing lattice sets from their X-rays. *Discrete Math.* 202 (1999), no. 1-3, 45-71.

It may be that the computational complexity of the beltway reconstruction problem remains open...?

See also the earlier MO question, "Largest pair of homometric Golomb rulers?"