Binary Tree Nodes

  • + 0 comments

    select distinct b1.N, case when b2.N is null AND b1.P is not null then 'Leaf' when b2.N is not null and b1.P is not null then 'Inner' when b1.P is null then 'Root' end as quoted

    from BST b1 left join BST b2 on b1.N = b2.P order by 1;