Question
#include using namespace std; int linearSearch(int [], int,int); void selectionSort(int[],int); int main(){ int max=10; int ar[10]; cout cout for(int i=0;i cin>>ar[i]; } cout int searchNumber;
#include
using namespace std;
int linearSearch(int [], int,int);
void selectionSort(int[],int);
int main(){
int max=10;
int ar[10];
cout
cout
for(int i=0;i cin>>ar[i]; } cout int searchNumber; cout cout cin>>searchNumber; int result = linearSearch(ar,max,searchNumber); if(result>=0){ cout } else{ cout } selectionSort(ar,max); cout cout for (int i=0; i cout return 0; } int linearSearch(int array[], int size,int numb){ for(int i=0; i { if(numb==array[i]) { return i; } } return -1; } void selectionSort(int ar[],int size) { int min; for(int i=0;i { min = i; for(int j = i+1 ;j if(ar[j] { min=j; } } swap (ar[i], ar[min]); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started