Part 5 of 15 in Binary Trees  

Print level order traversal of a binary tree. by animeshn

Problem statement

Given pointer to the root node of a binary tree of integers, write a function to print elements of the tree in its level-order traversal. You can assume that the header queue is already imported and print using cout for which the header iostream is also imported.


You need to write a function named "level_order" that will take root of a binary tree of integers as argument.


Your function should print all the elements in the binary tree in its level-order traversal, one element in each line.

To try out your code

Sign in

Sign up