Question: there is a set of numbers, from 1 to n (assuming n = 10000), from the arbitrary deletion of the three numbers, the order is also disrupted, the remaining number in an array of n-3, find the missing number, which requires faster algorithms.
The question is the front-end, but it is actually an algorithm question. Below is a relatively fast algorithm, which is said to be used in programming Pearl River.
Int _ tmain (INT argc, _ tchar * argv []) {int aold [] = {5, 1, 3, 0, 9, 2, 7, 8 int * anew = new int [11]; // actually, the subscript of an existing number is used for (INT I = 0; I <7; I ++) {int temp = aold [I]; anew [aold [I] = 1;} int * Alost = new int [3]; int K = 0; for (Int J = 0; j <11; j ++) {int IIi = anew [J]; If (anew [J]! = 1) {Alost [k] = J; k ++ ;}}
If (null! = Anew)
{
Delete anew;
Delete Alost;
Anew = NULL;
Alost = NULL;
}
) Return 0 ;}