i'm trying to write an algorithm for this problem
given n<2m numbers of m bits each design an O(n) time algorithm that finds an m-bit number that is different from all of the n given numbers. comparison is done in O(1) time.
my question is this. if i use a sort algorithm (say merge sort) which is O(nlogn) and then a for loop to check all the numbers against a number i've made (which would be O(n)), does this make the algorithm run time O(n)? or O(n+nlogn)?
any help would be greatly appreciated including tips on the algorithm design. I am quite stumpted on how to design this. I know that a for loop can do comparisons in O(n) with an if statement, but unless the array of numbers is pre-sorted, it won't work