How will the tree look like in this case?


  • 0
    T

    I am getting wrong answer for this input -

    {3,2,4,#,#,1}

    But I am not able to figure out how the tree will look like for this case. Can anyone please help me with a drawing.


  • 0
    L

    node [2i] is left child of node[i],node [2i+1] is right child of node[i],so the tree looks like this:

      3
    /    \
    

    2 ------- 4
    ---------/

      1     
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.