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

Spread the post

Binary search tree print Even level data using queue

Time complexity of this program O(n)

Accepted Output

Given BST tree node is:

50, 30, 70, 20, 35, 60, 90, 10, 85, 100, 15, 80

Edit Tree Click Here

5030702035609010851001580

Result

Even level node data is : 50 20 35 60 90 15 80

Given BST tree node is:

484, 448, 523, 431, 479, 501, 524, 422, 500, 514

Edit Tree Click Here

484448523501431514524479422500

Result

Even level node data is : 484 431 479 501 524

Below in C implementation of this problem. Iterative approach.

Output
  BST inserted Data is :   50   30   70   20   35   60   90   10   85   100   15   80
 Even level node data is :  50  20  35  60  90  15  80
 Free Memory of Queue

 Free BST nodes
 

Spread the post