+ 1
How do you remove duplicate nodes from an unsorted linked list?"
2 Antworten
+ 8
Something like this might work:
Create a set
while iterating over linked list, remove current item if it's in set then add current item to set
+ 1
Simplest way start at the beginning and check the rest for duplicates to remove. Once done, move to the second and check the rest for duplicates to remove. Repeat until you get to the last where there are none to check.