Finding the missing element in an array:
An array of size (n-1) contains all the numbers in the range [1..n] except one number which is missing. Write a program to find the missing number in O(n) time and O(1) space. For example let N= 5 and the input array is [1,3,4,5], the output should be 2. Given O(n) space we can always…