You are viewing a single comment's thread. Return to all comments →
SELECT N, IF(P IS NULL, 'Root', if( N IN (SELECT DISTINCT P FROM BST), 'Inner', 'Leaf' ) ) as bts FROM BST ORDER BY N;
Seems like cookies are disabled on this browser, please enable them to open this website
Binary Tree Nodes
You are viewing a single comment's thread. Return to all comments →
SELECT N, IF(P IS NULL, 'Root', if( N IN (SELECT DISTINCT P FROM BST), 'Inner', 'Leaf' ) ) as bts FROM BST ORDER BY N;