About 195,000 results
Open links in new tab
  1. Binary Tree Nodes in SQL | HackerRank Solution - CodingBroz

    Write a query to find the node type of Binary Tree ordered by the value of the node. Output one of the following for each node: Root: If node is root node. Leaf: If node is leaf node. Inner: If node …

  2. Classifying binary tree nodes using SQL - Stack Overflow

    Aug 7, 2018 · Here’s a explanation of the query: SELECT N, (CASE WHEN P IS NULL THEN 'Root' WHEN N IN (SELECT DISTINCT P FROM BST) THEN 'Inner' ELSE 'Leaf' END) AS …

  3. Binary Trees in SQL - Simple Talk - Redgate Software

    Jun 22, 2010 · Binary trees have lots of known mathematical properties. For example, the number of distinct binary trees with (n) nodes is called a Catalan number and it is give by the formula …

  4. HackerRank SQL. Binary Tree Nodes | by Isabelle - Medium

    Jun 21, 2021 · Write a query to find the node type of Binary Tree ordered by the value of the node. Output one of the following for each node: Root: If node is root node. Leaf: If node is …

  5. sql - Can anyone please explain this solution of HackerRank Binary Tree

    Jan 17, 2021 · The sub query refers to its own result and to the one of the main query (b.N) in it’s WHERE part. By removing the b alias, you also remove the possibility to reference to the main …

  6. Binary Tree Node in SQL : Online Learning Center

    We must write a query that returns the node type ordered by the value of nodes in ascending order. Each node in the tree can be one of three types: "Leaf": if the node is a leaf node. …

  7. sql - Solution of hackerrank Binary Tree Nodes question - Stack Overflow

    Feb 26, 2022 · You are given a table, BST, containing two columns: N and P, where N represents the value of a node in Binary Tree, and P is the parent of N. Write a query to find the node …

  8. Hackerrank - Calculating Leaf, Inner and Root Nodes in a Tree with SQL

    Feb 20, 2025 · Write a query to find the node type of Binary Tree ordered by the value of the node. Output one of the following for each node: Root: If node is root node. Leaf: If node is …

  9. HackerRank-Solutions/SQL/2_Advanced Select/04_Binary Tree ... - GitHub

    /* Working platform:- DB2, MySQL, Oracle, MS SQL Server */ SELECT N, CASE WHEN P IS NULL THEN 'Root' WHEN (SELECT COUNT (*) FROM BST WHERE P = A.N) > 0 THEN …

  10. Binary Trees in SQL - DBA Article

    a binary tree in which each node has exactly zero or two children and all leaf nodes are at the same level. A perfect binary tree has exactly ((2^h)-1) nodes, where (h) is the height. Every …

Refresh