I think we can do it like this way======================================PUSH QUEUE(ROOT)IF !ROOT PRINT POP QUEUE(ROOT)PUSH QUEUE(LEFT) && PUSH QUEUE(RIGHT)PRINT POP QUEUE(LEFT) && PUSH QUEUE LEFT(LEFT) && PUSH QUEUE RIGHT(LEFT)PRINT POP QUEUE(RIGHT) && PUSH QUEUE LEFT(RIGHT) && PUSH QUEUE RIGHT(RIGHT)Break when Queue is empty.Any better idea Kamlesh? I know you must have it.
I think we can do it like this way
ReplyDelete======================================
PUSH QUEUE(ROOT)
IF !ROOT
PRINT POP QUEUE(ROOT)
PUSH QUEUE(LEFT) && PUSH QUEUE(RIGHT)
PRINT POP QUEUE(LEFT) && PUSH QUEUE LEFT(LEFT) && PUSH QUEUE RIGHT(LEFT)
PRINT POP QUEUE(RIGHT) && PUSH QUEUE LEFT(RIGHT) && PUSH QUEUE RIGHT(RIGHT)
Break when Queue is empty.
Any better idea Kamlesh? I know you must have it.