Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Sep 11, 2019. It is now read-only.

gritt/binary-tree-level-order-traversal-dojo

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a HackerRank challenge:

https://www.hackerrank.com/challenges/tree-level-order-traversal/problem

Binary Tree Level Order Traversal

From a pointer to the root of a binary tree, in level order traversal, we visit the nodes level by level from left to right.

Input Format:

The first line contains an integer n, the number of nodes in the tree.

Next line contains n space separated integer where i integer denotes node[i].data.

Sample Input:

6
1 2 5 3 6 4

Which are arranged in the tree as:

 1
  \
   2
    \
     5
    /  \
   3    6
    \
     4 

Sample Output:

1 2 5 3 6 4

Binary Search Tree Reference

In a binary search tree, all nodes on the left branch of a node are less than the node value. All values on the right branch are greater than the node value.

About

in level order traversal, we visit the nodes level by level from left to right

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.