linked list and lcs