searching in c

searching in c BINARY SEARCH: A binary search locates an item in a sorted array by repeatedly dividing the search interval in half. The initial interval includes the entire array. If the value of the search key is less than the item in the middle of the interval, then...

binary search in c

binary search in c A binary search locates an item in a sorted array by repeatedly dividing the search interval in half. The initial interval includes the entire array. If the value of the search key is less than the item in the middle of the interval, then the next...

linear search in c

linear search in c PROGRAM: #include<stdio.h> int main(){ int a[10],i,n,m,c=0; printf(“Enter the size of an array: “); scanf(“%d”,&n); printf(“Enter the elements of the array: “); for(i=0;i<=n-1;i++){...

merge sort in c

merge sort in c Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. The merg() function is used for merging two halves. The merge(arr, l, m, r) is key process that...

quick sort in c

quick sort in c Make a list of items that need to be sorted, lets apply in an array. Choose any element as pivot element from the array list.(Complexity largely depends on choosing the pivot element).Rearrange the array list so that all the elements with value less...