property of xor: a xor b xor b = a. (because b xor b = 0) we can only perform xor operation on even no of nodes that raises 2 cases. case1: when the number of nodes are odd you can't perform xor operation on all elements, one element will be left out even if its value increases after xor operation. case2: since not all values increase after xor operation you would ideally want to not perform xor operation on those values that decrease after xor operation. But since we can only perform xor on even number of nodes there will be a case when u have to choose between taking a value that decreases after operation or leaving a value that increases after operation.
property of xor: a xor b xor b = a. (because b xor b = 0) we can only perform xor operation on even no of nodes that raises 2 cases. case1: when the number of nodes are odd you can't perform xor operation on all elements, one element will be left out even if its value increases after xor operation. case2: since not all values increase after xor operation you would ideally want to not perform xor operation on those values that decrease after xor operation. But since we can only perform xor on even number of nodes there will be a case when u have to choose between taking a value that decreases after operation or leaving a value that increases after operation.
Hi can you please explain the code it would be of great help
property of xor: a xor b xor b = a. (because b xor b = 0)
we can only perform xor operation on even no of nodes that raises 2 cases.
case1: when the number of nodes are odd you can't perform xor operation on all elements, one element will be left out even if its value increases after xor operation.
case2: since not all values increase after xor operation you would ideally want to not perform xor operation on those values that decrease after xor operation. But since we can only perform xor on even number of nodes there will be a case when u have to choose between taking a value that decreases after operation or leaving a value that increases after operation.
property of xor: a xor b xor b = a. (because b xor b = 0)
we can only perform xor operation on even no of nodes that raises 2 cases.
case1: when the number of nodes are odd you can't perform xor operation on all elements, one element will be left out even if its value increases after xor operation.
case2: since not all values increase after xor operation you would ideally want to not perform xor operation on those values that decrease after xor operation. But since we can only perform xor on even number of nodes there will be a case when u have to choose between taking a value that decreases after operation or leaving a value that increases after operation.