Duplicate occurance of the same value has to be removed. If the (linked)list traversed from head contains sequence 3,2,8,8,8,5,2,3 after calling
last = Node(3) head = Node(2, last) head = Node(5, head) head = Node(8, head) head = Node(8, head) head = Node(8, head) head = Node(2, head) head = Node(3, head) last.next = head
Now, the list, traversed from head, should contain 3, 2, 8, 5, 2 or 2, 8, 5, 2, 3. The value of ‘head’ equal None represents an empty list (a list having zero elements). How would I achieve this. This may be one of the easiest way to achieve. Since I am new to Python am having hard time in doing this.