Hackerrank Day 23: BST Level-Order Traversal

screen-shot-2016-12-30-at-1-34-42-pm

Solution in Ruby:

The internet came up with this solution because I barely understood this.  Still not sure why I have to dequeue the root node right after enqueuing it..

screen-shot-2016-12-30-at-1-59-44-pm

Binary Tree Traversals:

A traversal of a binary tree is an algorithm that iterates through each node in exactly 1 time.

These are the different ways to traverse:

Screen Shot 2016-12-30 at 1.52.04 PM.png

Advertisements
Hackerrank Day 23: BST Level-Order Traversal

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s