Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions rec_sort.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include<iostream>
using namespace std;


bool isSorted(int*a ,int n)
{
if(n==1)
{
return true;

}
if(a[0]<a[1]&& isSorted(a+1,n-1))
{
return true;
}

return false;


}
int main()
{

int N,i,arr[10];
cin>>N; //no_of_elements
for(i=0; i<N; i++)
{
cin>>arr[i];

}
if(isSorted(arr,N)){
cout<<"True";

}
else{
cout<<"False";
}
return 0;
}