Here are the links to the codes for MAXXOR function in MAX XOR pair and MAX XOR subarray
pair - https://ide.codingblocks.com/s/441305
subarray - https://ide.codingblocks.com/s/441306
here in the else statement when the bit == 1 ;
why do we need to change the position of current_ans statement?
shouldn’nt the logic remain same ?
Like if bit == 1 then we check if temp -> left != NULL ,
if yes ,
then we increment our current_ans;(for max XOR pair)
but in MAX XOR subarray , it goes in the else statement, that current_ans + = ( 1 << j ) ;
which means that If temp -> left != NULL then just continue to next temp value which doesn’t help us in building the XOR .
Why is this so??