Level Order Traversal of a Binary Tree

# Level Order Traversal of a Binary Tree -...

This preview shows pages 1–5. Sign up to view the full content.

Level Order Traversal of a Binary Tree Instructor : Prof. Jyh-Shing Roger Jang  Designer Shao-Huan Wang The ideas are reference to the textbook “Fundamentals of Data Structures in C “.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
A A B B C C D D E E F F G G H H I I J J K K L L NULL NULL f r 1.Prepare a tree and a queue,     f: front   r:rear 2.Add root to queue A 3.Get node from the queue and print data,    then add the left and right child to queue r f A Level Order Traversal of a Binary Tree
A A B B C C D D E E F F G G H H I I J J K K L L NULL NULL 1.Prepare a tree and a queue,     f: front   r:rear 2.Add root to queue B 3.Get node from the queue and print data,    then add the left and right child to queue r f A C r f 4.Go to step 3 until node is NULL B D E r r Level Order Traversal of a Binary Tree

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
A A B B C C D D E E F F G G H H I I J J K K L L NULL NULL 1.Prepare a tree and a queue,     f: front   r:rear
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/14/2011 for the course CSCI 1132 taught by Professor Haya during the Fall '11 term at GWU.

### Page1 / 8

Level Order Traversal of a Binary Tree -...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online