java - homework: to circular shift an unknown sized linked list without looping over its elements more than once and without creating a duplicate list? -
i got java assignment: i receive singly linked list head. allowed iterate on list once, , not duplicate it. receive positive integer n may bigger (unknown) list size. (the last node's 'next' field refers null) list must circular shifted n times, without duplicated operations. need return new head node. example n=5: 1 2 3 4 5 6 7 8 9 -> turns into 6 7 8 9 1 2 3 4 5 i fail see how possible when n bigger list size.. in advance when n bigger array size should start @ 0 again. it'd same if write: n=n%arraysize;