+ 1

How do you remove duplicate nodes from an unsorted linked list?"

11th Jan 2019, 4:54 PM
Mohamed Mikundi
Mohamed Mikundi - avatar
2 Réponses
+ 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
11th Jan 2019, 7:24 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 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.
11th Jan 2019, 6:57 PM
John Wells
John Wells - avatar