iOS

Merge Sort

Merge Sort is based on divide & conquer approach, first we divide array into two parts until we got single element then merge the single single element and create a subarray, Now merge two sorted subarray into single array likewise in final we got the final sorted array. In Conquer approach we have i, j […]

Merge Sort Read More »

Insertion Sort

# Approach Assume two part of the array sorted & unsorted. Sorted start from 1 element A[0] & fills with unsorted one by one (A[1] to A[n-1]) Attached code with dry run.  In Insertion sort we sort using two sets. One is Sorted set Another is unsorted one. Initially we sorted is index 0 element

Insertion Sort Read More »