There are many numbers in an array and each number appears three times excepting for one special number appearing once. Here is the question: how can I find the special numb
How about the following?
If we assume that you know the maximum and minimum values of all numbers in the array (or can at least limit them to some maximum range, say max - min + 1, then create an auxiliary array of that size, initialized to all zeros, say AuxArray[].
Now scan your original array, say MyArray[], and for each element MyArray[i], increment AuxArray[MyArray[i]] by one. After your scan is complete, there will be exactly one element in AuxArray[] that equals one, and the index of that element in AuxArray[] will be the value of the special number.
No complicated search here. Just a linear order of complexity.
Hope I've made sense.
John Doner