You are viewing a single comment's thread. Return to all comments →
Select DISTINCT a.N, CASE WHEN a.P is NULL THEN 'Root' WHEN b.N is NULL THEN 'Leaf' ELSE 'Inner' END From BST a LEFT JOIN BST b on a.N = b.P;
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 DISTINCT a.N, CASE WHEN a.P is NULL THEN 'Root' WHEN b.N is NULL THEN 'Leaf' ELSE 'Inner' END From BST a LEFT JOIN BST b on a.N = b.P;