Skip to content

Files

Latest commit

author
Shoaib Rayeen
May 10, 2019
e23d081 · May 10, 2019

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
May 10, 2019
May 10, 2019

Given a binary tree containing n nodes. The problem is to find the maximum sum obtained when the tree is spirally traversed. In spiral traversal one by one all levels are being traversed with the root level traversed from right to left, then next level from left to right, then further next level from right to left and so on.

                    -2
                    
           -3                  4
             
      5        1         -2        -1
      
 -3                                       2

Maximum spiral sum = 4 + (-1) + (-2) + 1 + 5 = 7