use array instead of linked list