i wrote this code that finds the number of members in the ascending sub sequence of the first cell(arr[0]).
and in that way i could find out the number of objects in every subsequence for evey cell
but i dont know how to compare each one of the results to find the biggest isnide this function.
??
i am allowed to enter parameters to the signature
Code:
#include <stdio.h>
int max_set(int arr[], int size,int index,int bef);
int main()
{
int array[7] = {9, 1, 3,0,7,10,11};
printf("%d\n",max_set(array,7,0,array[0])); //number of cells for ascending series of cell 0
return 0;
}
int max_set(int arr[], int size,int index,int bef)
{
int temp,bigger;
if (index==size)
{
return 1;
}
if (arr[index]>bef)
{
return 1+max_set(arr,size,index+1,arr[index]);
}
else
{
return max_set(arr,size,index+1,bef);
}
}//end of function