Linear Search / Sequential Search:
Searching Technique is done in Sequential Manner.
Sequential Search (A, i, x, n)
Set i =0
if>n
print element not found.
if A[i]=x
print Element Found.
i=i+1
Exit
Binary Search / Sequential Search
It is Fast Searching Algorithm with Time Complexity 0(log n).
Based on Divide and conquer.
Data Items should be in sorted manner.
Algorithm
while(low<=high)
mid = (low + high)/2
If X= A[mid]
return mid
If X>A[mid]
low=mid+1
else high =mid-1
Exit
Bubble Sort:
In bubble sort technique each pair of adjacent is Compared and Elements are swapped if they are not in order.
Worst Case time Complexity =0(n^2)
Algorithm
for( jb + k sort ho jaye )
if(list[i]>list[i+1]
Swap(list[i],list[i+1])
end if
end for
Exit
Selection Sort:
In this sorting technique the list is divided into 2 parts
Worst Case Time complexity 0(n^2)
Algorithm
Set min =0
Search Minimum Elements in the list.
Swap with value at location min.
Increase min to point to next element.
Repeat Until List is Sorted.
Important Point: 2 ways Selection Sort:
A. Sorted Path
B. Unsorted Path