We say two linked-lists are equal if they have the same number of elements, and the elements themselves are the same. Furthermore elements' order are not significant.
If compared linked-lists are not sorted, the straightforward approach to compare two linked-lists can be achieved in following way:
1)Define a method to determine whether a linked-list is a subset of the other. This can be achieved through enumerating every items in a list and determine whether they exist in the other list.
2)If a list is a subset of the other one, and vice versa, we can say that the two linked-lists are equal.
If compared linked-lists are sorted, comparing linked-lists become easier. I write the following program to sort linked-lists firstly, and then compare them. The sort algorithms can be categorized as inserting-sort.