a
b
fixed most of the things; the diff next and previous output the correct array values (i = 0123 next = 1233 prev = 0012