clang: error: linker command failed with exit code 1 (use -v to see invocation)
This happened to me simply because one function type did not match when
called recursively. I know there are other types of faults that might cause it.
But this is what happened to me.
Notice the Delete_Aux(t->left, item) recursive function calling.
TN *Delete_aux(TN *t, int item)
{
// complete this function
// write your code here
TN *temp;
if (t == NULL)
return NULL;
// if item is smaller go to the left node
if (t->data > item)
{
t->left = Delete_Aux(t->left, item); //Should be Delete_aux(t->right, item); Delete_Aux(t->left, item) is shown int type
return t;
}
else if (t->data < item)
{
t->right = Delete_Aux(t->right, item);
return t;
}
else
{
if (t->left == NULL && t->right == NULL)
{
free(t);
return NULL;
}
else if (t->left == NULL)
{
temp = t->right;
free(t);
return temp;
}
else if (t->right == NULL)
{
temp = t->left;
free(t);
return temp;
}
else
{
// get the smallest node in the right subtree temp = Leftmost(t->right)
t->data = temp->data;
t->right = Delete_Aux(t->right, temp->data);
return t;
}
}
}
Are there any code examples left?
New code examples in category Other
-
Other 2023-03-27 22:50:10 how to select the whole line in vscode with keyboard shortcut
-
Other 2022-03-27 22:45:24 income of a web developer
-
Other 2022-03-27 22:35:01 \pyrcc_main.py: File does not exist 'resources.qrc'
-
Other 2022-03-27 22:30:45 rick roll embed code
-
Other 2022-03-27 22:20:08 Circuit_04_Potentiometer
-
Other 2022-03-27 22:20:05 iterative power
-
Other 2022-03-27 22:15:11 flutter run all
-
Other 2022-03-27 22:10:05 when is karlson release
-
Other 2022-03-27 22:10:02 wp .htaccess example
-
Other 2022-03-27 22:00:08 bash pause in file read line by line