Summary
Keywords
Full Transcript
Support Simple Snippets by Donations - Google Pay UPI ID - tanmaysakpal11@okicici PayPal - paypal.me/tanmaysakpal11 --------------------------------------------------------------------------------------------- Theory - Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. his algorithm is suitable for small data sets Its average and worst case complexity are of - (n^2) where n is the number of items. It is known as bubble sort, because with every complete iteration the largest element bubbles up towards the last place or the highest index just like a water bubble rises up to the water surface. Working - Step 1 - Starting with the first element(index = 0), compare the current element with the next element of the array. Step 2 - If the current element is greater than the next element of the array, swap them. Step 3 - If the current element is less than the next element, move to the next element. Step 4 - Repeat Step 1 till the list is sorted. Full DSA playlist - https://www.youtube.com/watch?v=XCyuHSJS7XE&list=PLIY8eNdw5tW_zX3OCzX7NJ8bL1p6pWfgG Full Code & Theory article - https://simplesnippets.tech/insertion-sort-algorithm-with-program-data-structures-algorithms/ C++ Programming Tutorials for Beginners Course - https://www.youtube.com/watch?v=AKNGgAXTark&list=PLIY8eNdw5tW_o8gsLqNBu8gmScCAqKm2Q Simple Snippets Official Website - http://simplesnippets.tech/ Simple Snippets on Facebook - https://www.facebook.com/simplesnippets/ Simple Snippets on Instagram - https://www.instagram.com/simplesnippets/ Simple Snippets on Twitter - https://twitter.com/simplesnippet Simple Snippets Google Plus Page - https://plus.google.com/+SimpleSnippets Simple Snippets email ID - [email protected] For More Technology News, Latest Updates and Blog articles visit our Official Website - http://simplesnippets.tech/
