Skip to content
This repository was archived by the owner on Oct 5, 2025. It is now read-only.

insertionSort.js added#402

Open
Prasadkandekar wants to merge 2 commits intoHarshwardhanPatil07:mainfrom
Prasadkandekar:main
Open

insertionSort.js added#402
Prasadkandekar wants to merge 2 commits intoHarshwardhanPatil07:mainfrom
Prasadkandekar:main

Conversation

@Prasadkandekar
Copy link
Copy Markdown

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant