210 likes | 337 Views
This presentation is based on the insertion sort Algorithm. This insertion sort in data structures tutorial makes sure that sorting algorithms are explained well to help beginners learn insertion sort. The video also covers practical demo for a better learning experience.<br> <br>This presentation will cover the following concepts:<br><br>1. Introduction<br>2. What is insertion sort<br>3. insertion Sort Algorithm<br>4. Implementation<br>5. Conclusion<br>
E N D
Agenda What is Insertion Sort
Agenda Algorithm
Agenda Implementation
Agenda Conclusion
Introduction Insertion sort is a basic sorting algorithm in which each item in the final sorted array (or list) is sorted one at a time. It is significantly less efficient than more sophisticated algorithms like quicksort, heapsort, or merge sort on large data sets.
Introduction Insertion sort is a basic sorting algorithm in which each item in the final sorted array (or list) is sorted one at a time. It is significantly less efficient than more sophisticated algorithms like quicksort, heapsort, or merge sort on large data sets.
Introduction Insertion sort is a basic sorting algorithm in which each item in the final sorted array (or list) is sorted one at a time. It is significantly less efficient than more sophisticated algorithms like quicksort, heapsort, or merge sort on large data sets.
Algorithm We will traverse this array from arr[1] to arr[n-1]
Algorithm We will compare the current element with its predecessor
Algorithm If data at the current index is smaller than the predecessor, then we will compare it with the element before that
Algorithm We will shift bigger element on index up to make space for swapped element and then we will iterate same steps again to sort the complete array
Conclusion Insertion sort is efficient for arrays with small datasets. Insertion sort require a constant amount of extra memory Insertion sort can sort a single element at a time Insertion sort has worst complexity of O(n2)