c program to find the duplicate element in an ascending array using logn time complexity : <p>Array is in ascending order need to find the duplicated number
Need a program with logn time complexity  </p>

<pre><code>        int n[] = {1, 2, 3, 4, 5, 5, 6};


        int size = sizeof[n];
        int mid;
            mid = size/ 2 ;
            if (a[mid] == a[mid + 1])
                        printf("%d",a[mid]);
                        return a[mid];

            else if (a[mid] != a[mid + 1])
                        for(int i=0;i&lt;mid;i++){
                                        if(a[i]==a[mid+1])
                                           return a[i];
           }
           else
                        for(int i=mid ;mid&lt;size;i++){
                                        if(a[mid]==a[mid+1])
                                           return a[mid];
           }
</code></pre>
