Could someone potentially figure out the algorithm they use to generate these passwords?
That depends. My approach would be to simply generate human-readable output from
/dev/urandom, in which case this is not likely?
also these temp passwords have to be stored somewhere in plain text, correct?
Actually, no. If the site in question uses secure password storage schemes, i.e. salted slow hashes such as bcrypt or PBKDF2, what they need to do is store the derived hash of the password. In essence, it's the same as if you had instructed the server to change your password, except done on your behalf by the server.
The window for keeping that password in memory is therefore as long as it takes to generate it, send it in an email, hash it and store it.
Now, the real meat of the question is really is this a secure way to send somebody a password? The answer to that is not really, but the alternatives are:
The second option is likely prohibitive. The latter is not good password storage. The first option is "as bad" in the sense that all you need to hijack the account is access to that email.
I think, combined with a time-limited use window for this password reset, at present this is the best solution that is possible for general use websites that don't have the infrastructure to support other methods of password reset.
All of this answer assumes getting a password reset email/link requires knowing something about the account other than just the email address. Secret questions are a whole other can of worms, so let's assume that getting the password reset link/email is at least more difficult than knowing the email address.