# Algorithms



**what is Algorithm?**
          

- " Algorithm is a finite set of rules and regulation to solve a problem. "


      Characteristics of Algorithm:
      
      - Unambiguous
      -  Feasible
      - Well-Defined Inputs and Outputs
      - Finiteness
      - Effectiveness

                             


![Screenshot (98).png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669216736042/cFOS1-f03.png align="center")

## Searching Algorithm:

Some of the important searching algorithms are:
            
-                      ** Binary Search **   

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669219034764/Z5kv_WNSZ.png align="center")


      Binary Search is a searching algorithm used in a sorted array by repeatedly dividing the search interval in half.
    
      Begin with the mid element of the whole array as a search key.

      If the value of the search key is equal to the item then return an index of the search key.
    Or if the value of the search key is less than the item in the middle of the interval,     narrow the interval to the lower half.

      Otherwise, narrow it to the upper half.
      Repeatedly check from the second point until the value is found or the interval is empty.

  I learnt binary search algorithm from [Geeks for Geeks](https://www.geeksforgeeks.org/binary-search/)  and
   Kunal Kushwaha's YouTube channel(https://www.youtube.com/watch?v=f6UU7V3szVw&list=PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ&index=14)
              
  

- ** Linear Search**

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669219205811/zcK1mB5nd.png align="center")

    In linear Search, it is a sequential search algorithm.
    Linear search iterating from 0 to n-1
    if target value found in comparison then it return the value Otherwise it will not return 

## Sorting Algorithm:
      Some of the important Sorting Algorithms
        
            - Bubble Sort
            - Selection Sort
            - Insertion Sort     


-  **Bubble Sort**

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669221571610/d0EcGrSfP.png align="center")

    Bubble sort is a simple sorting algorithm.

    Bubble sort repeatedly swapping the adjacent elements if they are not in their correct         
    place

    This sorting algorithm is not suitable for large data.

**Selection Sort**

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669222112542/nGl68qReR.png align="left")


     selection sort algorithm sorts an array by repeatedly finding the minimum element from the unsorted part and putting it at the beginning. 
    The algorithm maintains two subarrays in a given array.
      The subarray which already sorted. 
      The remaining subarray was unsorted.
      In every iteration of the selection sort, the minimum element from the unsorted subarray is picked and moved to the sorted subarray. 


**insertion sort**

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669222958166/04hdsvPOu.png align="center")

    Insertion sort is a simple sorting algorithm
    This algorithm is one of the simplest algorithm with simple implementation
    Basically, Insertion sort is efficient for small data values
    Insertion sort is adaptive in nature, i.e. it is appropriate for data sets which are already     partially sorted.
























     
