Posts

Showing posts from November, 2019

Bubble sort

Image
Sorting Sorting is a process in which we arrange the data of  any list in any particular order  such as ascending order and descending order.

Searching

Image
Searching Searching is a operation in which any particular data is search in the list.The search is said to be successful or unsuccessful depending on whether searching is found or not. there are two  method to search element- linear search and Binary search. Linear search This is simple method of searching. In this method,the element is searched in sequence order as one by one.This method can applied on sorted or an unsorted list 10 30 50 60 20 40 80 70 100 90 The array shown in figure consist 10 number.Suppose  the element 60 is searched, so 60 is compared with starting with 0th position and searching process is ends either when 60 is found or the list ends. The number of comparisons in linear searching is 0(n). void linear_searching( int a[], int size,int svalue) {     int i, flag=0;     for(i=0;i<size;i++)     {         if(a[i]==svalue)         {             flag=1;             break;