11-05-2011, 05:26 PM
In level-order traversal, we start from the first level, print all nodes from left to right and move to the next level. We continue it untill we reach last level.
Now as you know queue is FIFO (First In First Out) structure, it helps us in level-order traversal. Lets see how?
The procedure is to insert all nodes on first level into queue, then dequeue node, print it and inserts its left and right child nodes into queue. Continue untill queue is empty.
Now as you know queue is FIFO (First In First Out) structure, it helps us in level-order traversal. Lets see how?
The procedure is to insert all nodes on first level into queue, then dequeue node, print it and inserts its left and right child nodes into queue. Continue untill queue is empty.
0300-9520262
Get solution in 24 hour |cpmputer & internet
mileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
