This question evaluates proficiency in linked list manipulation, duplicate detection and removal, and algorithmic complexity analysis for both sorted and unsorted data.
Given a linked list, remove all duplicate values so that each value appears only once. Provide solutions for both sorted and unsorted linked lists, along with their time and space complexity analyses.