Aim: Write A Program To Implement Insertion Sort. Theory: Insertion Sort Is The Simple Sorting Algorithm That Is
Aim: Write A Program To Implement Insertion Sort. Theory: Insertion Sort Is The Simple Sorting Algorithm That Is
}
Aim: Write a program to implement Binary Search
while(first<=last)
{
if(a[middle]<search)
{
first=middle+1;
}
else if(a[middle]==search)
{
printf("The number %d is found in the list at the
position %d\n",search,middle+1);
break;
}
else
{
last=middle-1;
}
middle=(first+last)/2;
}
if(first>last)
{
printf("Element not found\n");
}
return 0;
}
Aim: Write a program to implement Selection Sort
{
if(a[position]>a[j])
{
position=j;
}
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
printf("The number after selection sorting are: ");
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
printf("\n");
return 0;
}
Aim: Write a program to implement Bubble sort
Output2.
Output1
Output3
Output4
Output5
Output 6
Output7