You are viewing a single comment's thread. Return to all comments →
select N, CASE WHEN P is null THEN 'Root' WHEN N not in (select P from BST where p is not null) THEN 'Leaf' ELSE 'Inner' 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 not in (select P from BST where p is not null) THEN 'Leaf' ELSE 'Inner' END from BST order by N