Binary Tree Nodes

  • + 0 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 as n_type
    from BST
    order by n;