Well, the algorithm can use data from any routes or partial route sections that the new route covers. This means that,
* If the new route is "out and back" it already has two sets of data and the "out part" can be matched with the "back part" and vice-versa
* If the new route is a loop that runs three times, there are already 3 sets of data to average from.
* If a section of your new route was covered by another ride or rides, it can correct elevation on that section (after many years of riding around my city, even if the route is "new", all portions of it would be covered by some previous ride).
* If you ride the same route a second time next week, you can go back to the first one and correct the elevation with the new data you have.
The algorithm works better the more data you have from previous rides, but the only time it does not work at all is when your ride is a once-in-a-lifetime ride from point A to point B with no overlaps.
And when it works, it works really well. The image below is from an "out and back" run along the coast, which I've done many times. The top graph is the original elevation and you can see that it is slowly dropping and the finish is about 5 meters lower than the start -- this is because we had a weather front passing and the barometric pressure was increasing, so the barometric altimeter in the watch was fooled. The bottom graph shows the corrected elevation, and you can more clearly see that the second half is a mirror of the first.
Barometric altimeters are affected by weather. The highest 1 hour "altitude change" for a fixed position (where altitude didn't actually change) was 14.5 meters or about 47 feet. I analyzed my altitude data from barometric readings here:
Barometric Altitude Measurement (alex-hhh.github.io)
Alex.