changed
to True
to track if any changes are made in the current iteration.changed
is True
, set it to False
and create a copy of the current array to compare after the iteration.changed
to True
if an update occurs.changed
is still False
, break the loop as the array has reached its final state.