Segmentation fault (core dumped) when I delete pointer
问题 I am trying to remove duplicates from a linked list, and encountered a problem, which is probably obvious and straightforward but I haven't used C++ in many years and I couldn't find out what I am doing wrong by reading similar questions on SO. Below is parts of my code. I removed irrelevant parts (eg. constructors, other methods, etc). template<class T> class Node { Node() : data(NULL), next(NULL), prev(NULL) {} explicit Node(T d) : data(d), next(NULL), prev(NULL) {} explicit Node(T d, Node