How to find 4 byte number that was absent in input?
<p>I have such task, and actually have no idea how to start.
On the input I have a huge array of 4-byte positive numbers. Numbers can be repeated. I know that one of the number is not included in the input array. How can I find this number, using minimum resources?</p>

<p>You haven't specified how you know what the original set of values is, so I'm going to go ahead and just assume that you have two lists of values, <code>set1</code> and <code>set2</code>, which may or may not contain duplicates, may or may not be in the same order, and differ by a single element which you wish to identify. I'm not going to worry about how the sets originated.</p>

<p>With that setup, you can XOR all of the data.  The result will be your missing value.  To illustrate this, I have a small demo that creates two identical lists, randomly deletes an element from the second one (and retains the value for checking), shuffles the lists, and does the XOR.</p>

<pre><code>import random as r
from functools import reduce

def xor_all(lst):
    return reduce(lambda x,y: x ^ y, lst)

set1 = [1,2,3,3,4,5,6,7,8,8,9]
r.shuffle(set1)
set2 = [1,2,3,3,4,5,6,7,8,8,9]
rv = set2.pop(r.randrange(len(set2)))
r.shuffle(set2)

print("deleted value was: ", rv)
print("xor_all identified: ", xor_all(set1) ^ xor_all(set2))
</code></pre>

python algorithm