×

Learn basic concept of c , c++ and python programming in regularcodes.com

# Count leaf node of binary search tree (iterative approach) using queue

Time complexity of this program O(n)

#### Accepted Output

** Given BST data is: **

555, 483, 593, 437, 518, 594, 475, 514, 467, 514

In this tree leaf node are [ 467, 514, 594 ].

**Result :**

Number of leaf Node is [3]

** Given BST data is: **

515, 93, 30, 20, 40, 104, 115, 134, 610

Result :

Number of leaf Node is [4]

Below in C implementation of this problem. Iterative approach.

Output

BST Data is : 30 40 90 104 104 115 140 220 240 Number of leaf Node is [3] Free Memory of Queue Free BST node

View comments and participate Discussion