Changing the gap penalty can change which alignment is optimal.
highlighted = computed this step
A cheaper gap can change the winner
With gap penalty −1, inserting gaps beats paying for mismatches, so the traceback gives -AC aligned with CA-. With gap penalty −2, the same pair aligns as AC with CA.
gap=−1:-AC↔CA-,gap=−2:AC↔CA
The scoring scheme determines the answer
There is no single correct gap penalty. The penalty encodes a biological assumption about how costly insertions and deletions should be, and changing that assumption can change the optimal alignment.