A Simple😉 beginner friendly😊 Repo for all programmers and coders. All contributors are requested to star🌟this repo and and folllllow me. Contribute to start your journey with hacktoberfest. Happy Hacking💻!!!
How Insertion Sort Works works:
The outer loop goes through the array starting from index 1.
The inner loop compares the current element (key) with the elements before it and shifts the larger elements one position to the right.
The key is inserted into its correct position once the proper place is found.
The time complexity of this algorithm is
𝑂(𝑛2)
O(n 2) in the worst and average cases, where 𝑛n is the number of elements in the array.
How Insertion Sort Works works: The outer loop goes through the array starting from index 1. The inner loop compares the current element (key) with the elements before it and shifts the larger elements one position to the right. The key is inserted into its correct position once the proper place is found. The time complexity of this algorithm is 𝑂(𝑛2) O(n 2) in the worst and average cases, where 𝑛n is the number of elements in the array.