I wrote the following function, please tell me if she is ok.
1) The function should print the share parent or "No shared parent" when is'nt exist.
struct node * parent;
typedef struct node node;
void sameParent (node * n1, node * n2)
node * save_n2 = n2;
while (n1 != NULL)
while(n2 != NULL)
if (n1 == n2)
printf ("No shared parent");
2) Can someone offer more effective code ? this one is O (n^2)