Hello, I'm having trouble with this class that is not to allow duplicates. It appends the items from one object into another. The method worked fine when I didn't check for duplicates, but since I added code to check for duplicates the program just hangs when it gets to the last number for a few minutes and then crashes. Any advice would be appreciated. I am just getting into using this type of problem so I'm not sure if I'm making a stupid mistake with the node. Here is the method:
newNode->link = current->link;
newNode->link will point to a node inside otherSet. That can't be right. Shouldn't newNode->link be set to null or something instead?
Thanks Peter. I looked further into this and found that in fact neither of my methods were working correctly, it only appeared that way. If I would append the objects and then delete the 2nd object it would crash when printing the first b/c the result was only keeping a copy of that other object's item in the list b/c of the newNode->link = current->link... not really making it anew in the original object. I have adjusted this and it works now. Thanks again.