Sorting_and_Searching_Algorithms
Sorting_and_Searching_Algorithms
Working Procedure:
Implementation in C:
#include <stdio.h>
if (arr[mid] == target) {
return mid;
}
int main() {
int arr[] = {2, 5, 8, 12, 16, 23, 38, 56, 72, 91};
int n = sizeof(arr) / sizeof(arr[0]);
int target = 23;
if (result == -1) {
printf("Element not found in the array");
} else {
printf("Element found at index %d", result);
}
return 0;
}
Working Procedure:
Implementation in C:
#include <stdio.h>
int main() {
int arr[] = {64, 34, 25, 12, 22, 11, 90};
int n = sizeof(arr) / sizeof(arr[0]);
bubbleSort(arr, n);
printf("Sorted array: \n");
printArray(arr, n);
return 0;
}