Remove duplicate copies of a number from unsorted linked list

def remove_dup(self,head):   curr = head 
while(curr):
runner=curr
while(runner.next):
if runner.next.data==curr.data:
runner.next=runner.next.next
else:
runner=runner.next
curr=curr.next return head
def remove_dup(self,head):  curr = head 
while(curr):
if curr.data in hash_set:
prev.next=curr.next
else:
hash_set.add(curr.data)
prev=curr
curr=curr.next
return head

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dhanarajappu

Dhanarajappu

Tech-Enthusiast, Coder,Explorer,Geeky,Software Engineer |A piece of code delivers everything that you need. The world is all about codes.