//find the second biggest number in a given array of size n. you have to use n+logn number of searches or less
#include<iostream>
using namespace std;
int main()
{
  
    int arr[]= {1, 2 ,  3 , 4 , 17 , 4, 3, 18 , 9 , 15, 6 , 32 ,65, 72};
    int max1=0,max2=0;
    for(int i=1;i<sizeof(arr)/sizeof(int);i++)
    {
            if(arr[max1]>arr[i])
            {
                   if(arr[max2]<arr[i])
                   {
                         max2 = i ;              
                   }
            }
            else
            {
             max2 = max1;
             max1 = i ;
   
            }
    }
    cout<<arr[max2];
    system("pause");
}
