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

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How We #ChoosetoChallenge And Celebrate Women in Tech

String Interpolation in Scala

Knoldus-blog-footer-image

Building Pytorch c++ integration (libtorch) with MS Visual Studio 2017

Override the Default Behaviour for Plotly Date Axes

Reflecting on the first 10 days of neurithm.

How I launched My Career in Web Development in Less Than a Year

C#: Delegates and Events

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.

More from Medium

LeetCode 129. Sum Root to Leaf Numbers

Meeting Room Problems

Image

Heading Into JVM

Why should we study algorithms? — [Introduction to Algorithms]