Find the missing element in vector
You dont need the sorting. The vector contains numbers 1 to (n + 1) with one number omitted. If it wasnt omitted it would sum up to (n+ 1)*(n+ 2)/ 2. Sum the vector, subtract it from the full sum And what Is left over Is the number that was omitted.