Hi,
this function has to check if an array is not descending it has to be recursive and it's space complexity has to be O(log(n))
Code:int is_sorted(int a[ ], int n) { int check=n-1; if(n==1 || n==0) return 1; if(a[check]<a[check-1])return 0; else return(is_sorted(a,n-1)); }
this is what i came up with. i know it's space complexity is O(n) how do i make it O(log(n))?