fprintf(stderr, "Error: data structure has not been constructed properly\n");\r
exit(1);\r
}\r
-\r
- return parent(Par, x);\r
+ if (x == Root())\r
+ return NULLT;\r
+ else\r
+ return parent(Par, x);\r
}\r
\r
// Child(x,i): returns the i-th child of node x, assuming it exists.\r
fprintf(stderr, "Error: data structure has not been constructed properly\n");\r
exit(1);\r
}\r
-\r
+ if (x == Root())\r
+ return NULLT;\r
+ \r
return next_sibling(Par, x);\r
}\r
\r