You are viewing a single comment's thread. Return to all comments →
I Just share my solution:
SELECT N, CASE WHEN EXISTS (SELECT * FROM BST AS firstCondition WHERE firstCondition.N = firstTable.N AND firstCondition.P IS NULL) THEN 'Root' WHEN NOT EXISTS (SELECT * FROM BST AS secondCondition WHERE secondCondition.P = firstTable.N) THEN 'Leaf' ELSE 'Inner' END FROM BST AS firstTable 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 →
I Just share my solution: