You are viewing a single comment's thread. Return to all comments →
SELECT O.N, CASE WHEN O.P is null THEN 'Root' WHEN O.N IN (SELECT DISTINCT C.P FROM BST C) THEN 'Inner' ELSE 'Leaf' END FROM BST O ORDER BY O.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 O.N, CASE WHEN O.P is null THEN 'Root' WHEN O.N IN (SELECT DISTINCT C.P FROM BST C) THEN 'Inner' ELSE 'Leaf' END FROM BST O ORDER BY O.N