convert a nested array to a nested linked list