How are duplicate nodes removed in an unsorted linked list?