How can I remove nodes with duplicate data from a linked list. I am having trouble writing the while loop.
How can I remove nodes with duplicate data from a linked list. I am having trouble writing the while loop.
"In theory, there is no difference between theory and practice. But, in practice, there is."
- Jan L.A. van de Snepscheut
Walk through the list and when you encounter a new node, add it to another list. When you run out of new nodes (ie. each node you encounter in the old list already exists in the new list), you've removed all the duplicates. Or you can do it the same way you would with an array: Walk through the list, for each node walk through the list again searching for duplicates, if you find any, remove them.
The information given in this message is known to work on FreeBSD 4.8 STABLE.
*The above statement is false if I was too lazy to test it.*
Please take note that I am not a technical writer, nor do I care to become one.
If someone finds a mistake, gleaming error or typo, do me a favor...bite me.
Don't assume that I'm ever entirely serious or entirely joking.