In: Computer Science
Counting integers greater than 10
Write the pseudo-code for a brute force approach to counting the number of integers greater than 10 in an array of n integers.
Write the pseudo-code divide-and-conquer algorithm for counting the number of integers greater than 10 in an array of n integers.
Give the recurrence relation for the number of comparisons in your divide-and-conquer algorithm in part b.
#include<stdio.h>
#include<conio.h>
main(){
int a[100],n;
int i=0,count=0;
printf("Enter the size of array ");//takes input the
size of array
scanf("%d",&n);
printf(" \n Enter the data\n");
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
i=0;
while(a[i]!=NULL){
if(a[i]>10){
count=count+1;
//here it checks the condtion for every element if the element
greater than 10 then count will be increased
}
i++;
}
printf("\n The number of elements greater than 10 are
%d ",count);
}
Thank you.