Source Code:https://thecodingsimplified.com/inser...
Solution:
- Our aim is to sort the array as soon as we insert any value
- We solve this using two loops
- We insert the value at the end of array & compare with all previous value
- If inserting value is less than previous value then we place previous value to current next index
- At last we place key to its position once we're out from the loop
Time Complexity: O(n * n)
Space Complexity: O(1)
Do Watch video for more info
CHECK OUT CODING SIMPLIFIED
/ codingsimplified
★☆★ VIEW THE BLOG POST: ★☆★
http://thecodingsimplified.com
I started my YouTube channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 400+ videos.
★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★
https://www.youtube.com/codingsimplif...
★☆★ Send us mail at: ★☆★
Email: [email protected]