#include<iostream>
using namespace std ;
void selectionSort(int *arr, int N)
posmin = findIndexMin(arr,count,N);
void selectionSort(int *arr, int N)
{
int posmin, count, tmp;
for(count=0;count<N;count++)
{
posmin = findIndexMin(arr,count,N);
tmp=arr[posmin];
arr[posmin]=arr[count];
arr[count]=tmp;
}
}
int findIndexMin(int *arr, int start,int N)
{
int posmin=start;
int index;
for(index=start; index < N; index++)
if (arr[index]<arr[posmin])
posmin=index;
return posmin;
}
int main
{
int N =10 ;
int arr[]={13,15,19,5,31,2,3,4,9,10}
cout<<"enter value display ;
using namespace std ;
void selectionSort(int *arr, int N)
posmin = findIndexMin(arr,count,N);
void selectionSort(int *arr, int N)
{
int posmin, count, tmp;
for(count=0;count<N;count++)
{
posmin = findIndexMin(arr,count,N);
tmp=arr[posmin];
arr[posmin]=arr[count];
arr[count]=tmp;
}
}
int findIndexMin(int *arr, int start,int N)
{
int posmin=start;
int index;
for(index=start; index < N; index++)
if (arr[index]<arr[posmin])
posmin=index;
return posmin;
}
int main
{
int N =10 ;
int arr[]={13,15,19,5,31,2,3,4,9,10}
cout<<"enter value display ;
Post A Comment:
0 comments: