Q1: initially compute xor of all the values from 0 to n in a variable Temp
so temp = 0^1^2........^n
let result is used to store the missing number
for each ith bit of missing number where i = 0-31 we can find it as
following
ith bit of result = (xor of all ith bits of values of array) xored with (ith
bit of temp)

Overall complexity is O(32n) which is same as O(n)


-- 
Sunny Aggrawal
B-Tech IV year,CSI
Indian Institute Of Technology,Roorkee

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to