I have a linked list created and my goal is to delete repetition of data in the linked list. There is only a data and pointer component in each node. The algorithm might not be perfect, but my concern is why am I getting the error SIGABRT
in Xcode when trying to delete a node.The error occurs in code when the if
condition is true. No idea what SIGABRT
means.
void LinkedList::deleteRepetition(const LinkedList& list)
{
node* temp_value = nullptr;
node* traverser = nullptr;
temp_value = head;
traverser = head;
for (int i = 0; i < NODES; i++)
{
for (int j = 0; j < NODES - i; j++)
{
traverser = temp_value->next;
if (traverser->data == temp_value->data)
{
delete traverser;
}
}
traverser = temp_value;
temp_value = temp_value->next;
}
}