Remove Duplicates from Sorted List

Posted on

Idea 1: Iteration

Set a new pointer node, keep the original head as leading out the whole list

Screen Shot 2015-10-07 at 7.45.38 PM

Idea 2: Recursion

Delete the repeated node for the first node, and use recursion repeatedly apple the deleting to all other following nodes.

Screen Shot 2015-10-07 at 7.55.30 PM

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s