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 type from bst ORDER BY N;