You are viewing a single comment's thread. Return to all comments →
SELECT N, CASE WHEN p IS NULL then 'Root' WHEN N IN (SELECT p FROM BST WHERE p IS NOT NULL) THEN 'Inner' else 'Leaf' end 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, CASE WHEN p IS NULL then 'Root' WHEN N IN (SELECT p FROM BST WHERE p IS NOT NULL) THEN 'Inner' else 'Leaf' end FROM BST order by N