You are viewing a single comment's thread. Return to all comments →
SELECT t.N, CASE WHEN t.N = (SELECT N FROM BST WHERE P is NULL) THEN "Root" WHEN COUNT(t.N)>1 THEN "Inner" WHEN COUNT(t.N) = 1 THEN "Leaf" END FROM ( SELECT N FROM BST UNION ALL SELECT P FROM BST ) AS t WHERE t.N IS NOT NULL GROUP BY (t.N) ORDER BY t.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 →