array stuff for linked list sorting