Best algorithm for time-scaling
The best depends exclusively on the type of signal you want to modify, if you just need apply time scale in monophonic (Speech), PSOLA and TDHS can give to you very nice results, but It is not as easy as you read in books, find Pitch Marks (Glottal Closure Instant) in PSOLA is really a big problem, in TDHS if your pitch track are consistent you can scale the signal to the hell, for Time scaling unsig FFT (commonly known as phase vocoder) this works better in polyphonic signals and to get best results here do you need use a locked phase vocoder.

Find the length is a easy step, for stretch factor between 0.5 and 2.0 you can use some time domain technics: ola, sola, wsola, psola, tdhs, you can try keith lent (I consider a bit different of PSOLA) in the Lent code you can try 50% of crossfade hann window that works nice for my ears.