Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove duplicate values from a list in c++? [closed]

Tags:

c++

I am new to c++ and stuck to a problem. I am using list for storing string values. now i want to remove the duplicate values from that string. Can anyone tell me how do this.

Any sample code will be highly appreciate.

like image 704
shekhar Avatar asked Feb 02 '11 17:02

shekhar


People also ask

How are duplicate nodes removed in an unsorted linked list in C?

Write a removeDuplicates() function that takes a list and deletes any duplicate nodes from the list. The list is not sorted. For example if the linked list is 12->11->12->21->41->43->21 then removeDuplicates() should convert the list to 12->11->21->41->43.


1 Answers

Use sort followed by unique.

like image 130
Alexandre C. Avatar answered Sep 26 '22 01:09

Alexandre C.