find missing number in a sorted and unsorted array