You are viewing a single comment's thread. Return to all comments →
no need of CTE in this problem.
you can do this using case when:-
select N, case when p is null then 'Root' when p is not null and n in (select p from BST) 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 →
no need of CTE in this problem.
you can do this using case when:-
select N, case when p is null then 'Root' when p is not null and n in (select p from BST) then 'Inner' else 'Leaf' end from BST order by N