check if the parent is at odd or even level and perform OR or XOR according to that
if level [ pos ] & 1 : NEW_LINE INDENT tree [ pos ] = tree [ 2 * pos + 1 ] | tree [ 2 * pos + 2 ] NEW_LINE DEDENT else : NEW_LINE INDENT tree [ pos ] = tree [ 2 * pos + 1 ] ^ tree [ 2 * pos + 2 ] NEW_LINE DEDENT