# What is the difference between RAM and TM?

In algorithm analysis, we assume a generic one processor Random Access Machine (RAM). As far as I know, the RAM machine is no more efficient than the Turing machine. All algorithms can be implemented in the Turing machine. So my questions are:

• If the Turing machine is as efficient as the RAM machine, then why are we not assuming Turing machine for algorithm analysis?

• What is the difference between RAM and TM?

Turing machines are not as efficient as RAM machines. A RAM machine can access an arbitrary tape location in $O(1)$. A Turing machine can't. A RAM machine can do arithmetic in $O(1)$ (under certain restrictions). A Turing machine can't.
Turing machines polynomially simulate RAM machines, that is, for some constant $c$, any RAM machine running in time $O(n^k)$ can be simulated by a Turing machine running in time $O(n^{ck})$. (The constant is pretty reasonable, about $2$, depending on the Turing machine model.)
• I get $2$ since that's (roughly) the time it naively takes to simulate random access. I could be wrong here. – Yuval Filmus Mar 9 '14 at 12:30
• Just a quick question: If a problem $\Pi$ has a polynomial-time algorithm on the RAM model, can I say that $\Pi$ has a polynomial-time algorithm on the TM model? Or alternatively, If a problem $\Pi$ has a polynomial-time algorithm on the RAM model, can I say that $\Pi$ is in P? – drzbir Dec 29 '16 at 19:35