Binary Tree Nodes

  • + 0 comments

    SELECT N, CASE

    WHEN P is null THEN 'Root' WHEN N IN (SELECT P FROM BST) THEN 'Inner' ELSE 'Leaf'

    END AS node_type

    FROM BST order by N;