Are these two algorithms the same?
Starting with a vague definition of algorithm, you won't get a clear-cut answer. Here are two possible ways to look at it.


Algorithms are high-level constructs, that is we distinguish idea from implementation. In that sense,

for ( i=1; i&lt;n; i++ ) {
  print i
}


and

i = 1
while ( i &lt; n ) {
  print i
  i++
}


are implementations of the same algorithm, but clearly not the same program. And while this simple example may actually translate to the same machine code for many real languages, it's clear that they don't have to. So whether the programs create the same sequence of states depends on your machine model.

This is a hint that tying your notion of algorithm to a specific machine model is probably not useful.
Algorithms are specific sequences of instructions for fixed machine models. Then, the answer depends on your machine model.


If there is exactly one statement for every possible state change, then
a sequence of states induces a unique sequence of statements. Hence, if
all inputs cause identical state sequences, the algorithms/programs are
the same.
If multiple statements can cause the same state change, then the opposite is true.