Pattern Matching, Insertion Sort, Radix Sort
Pattern Matching, Insertion Sort, Radix Sort
#include <stdio.h>
#include <string.h>
int main()
char text[20],pat[20];
int a,b;
scanf("%s",&text);
scanf("%s",&pat);
a = strlen(pat);
b = strlen(text);
int j;
if (text[i + j] != pat[j])
break;
if (j == a)
return 0;
Insertion Sort:
#include<stdio.h>
int main(){
*/
scanf("%d",&count);
for(i=0;i<count;i++)
scanf("%d",&number[i]);
for(i=1;i<count;i++){
temp=number[i];
j=i-1;
while((temp<number[j])&&(j>=0)){
number[j+1]=number[j];
j=j-1;
number[j+1]=temp;
for(i=0;i<count;i++)
printf(" %d",number[i]);
return 0;
}
Radix sort:
#include <stdio.h>
max = array[i];
return max;
// Using counting sort to sort the elements in the basis of significant places
max = array[i];
count[i] = 0;
array[i] = output[i];
// Print an array
printf("\n");
// Driver code
int main() {
radixsort(array, n);
printArray(array, n);