

{"id":96533,"date":"2021-06-14T09:00:33","date_gmt":"2021-06-14T03:30:33","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=96533"},"modified":"2021-06-26T19:29:05","modified_gmt":"2021-06-26T13:59:05","slug":"bubble-sort","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/bubble-sort\/","title":{"rendered":"Bubble Sort  in Data Structure"},"content":{"rendered":"<p>Ever witnessed a car racing tournament? There are multiple laps in a race. While the race is in progress, let\u2019s say team A is in 4th position. Team B is just behind team A and Team C is ahead of Team A. Now, in lap 1, if team A is faster than team C, it will overtake it. In other words, teams A and C swap their positions. Similarly, if team E is faster than team F, they will swap positions. In the next lap, Team B and C might swap positions depending on their speed comparisons.<\/p>\n<p>A bubble sort algorithm works in a similar manner. Consider each lap as one iteration. It swaps all the places not in order in a single iteration and moves to the next iteration. Here, we will learn the working of the bubble sort algorithm, and an optimized approach for the same.<\/p>\n<h3>Bubble sort<\/h3>\n<p>Bubble sort is the simplest sorting algorithm. Sorting is the process of arranging the elements in a dataset either in ascending or descending order. In this comparison-based sorting algorithm, each pair of adjacent elements is compared. If the elements are not found to be in the required order, they are swapped.<\/p>\n<p>1. After each iteration, the largest remaining element is at the highest index. (while arranging in ascending order.)<br \/>\n2. Swaps adjacent elements only.<\/p>\n<h4>Working of bubble sort<\/h4>\n<p>1. Start for the starting index. Compare the current element to the next element.<br \/>\n2. If the current element and next element are not in order, swap them.<br \/>\n3. Repeat step 2 until you reach the end of the array. This is the end of iteration 1.<br \/>\n4. Repeat steps 1, 2, 3 until the array is sorted.<\/p>\n<h4>Bubble Sort Algorithm<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Step 1: Repeat For i = 0 to N-1\r\nStep 2: Repeat For j = i + 1 to N - I\r\nStep 3: If Arr[ j ] &gt; Arr[ i ]\r\n             swap Arr[ j ] and Arr[ i ]\r\n             [end of step 2]\r\n             [end of step 1]\r\nStep 4: stop\r\n\r\n<\/pre>\n<h4>Bubbel Sort Pseudocode<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">procedure bubbleSort( array)\r\n\r\n   len = array.length;\r\n   \r\n   for i = 0 to loop-1 do:\r\n    \r\n      for j = 0 to loop-1 do:\r\n        \r\n         if list[j] &gt; list[j+1] then\r\n            swap( list[j], list[j+1] )\t\t \r\n         end if\r\n         \r\n      end for      \r\n   end for\r\n return array\r\nend procedure\r\n\r\n<\/pre>\n<h4>Example of Bubble Sort<\/h4>\n<p>Let\u2019s sort the characters in the word \u201cDATAFLAIR\u201d by the bubble sort technique.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96573\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_1.png\" alt=\"Bubble Sort Working\" width=\"402\" height=\"42\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_1.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_1-300x31.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_1-150x16.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_1-320x33.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<h5>ITERATION 1<\/h5>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_5-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96583\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_5-1.png\" alt=\"Swapping in Bubble Sort\" width=\"402\" height=\"98\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_5-1.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_5-1-300x73.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_5-1-150x37.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_5-1-320x78.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_31.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96584\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_31.png\" alt=\"Swap in Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_31.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_31-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_31-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_31-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_25.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96585\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_25.png\" alt=\"Bubble sort working\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_25.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_25-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_25-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_25-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_3-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96586\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_3-1.png\" alt=\"Bubble Sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_3-1.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_3-1-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_3-1-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_3-1-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_24.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96587\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_24.png\" alt=\"Bubble Sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_24.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_24-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_24-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_24-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_26.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96588\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_26.png\" alt=\"Working of bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_26.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_26-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_26-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_26-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_10-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96589\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_10-1.png\" alt=\"Bubble sort algorithm\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_10-1.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_10-1-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_10-1-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_10-1-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_13.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96590\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_13.png\" alt=\"Bubble Sorting \" width=\"402\" height=\"96\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_13.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_13-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_13-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_13-320x76.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_8-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96591\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_8-1.png\" alt=\"Bubble Sort\" width=\"402\" height=\"42\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_8-1.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_8-1-300x31.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_8-1-150x16.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_8-1-320x33.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>After iteration 1 \u2018T\u2019, the largest element is set at the last position.<\/p>\n<h5>ITERATION 2<\/h5>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_14.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96592\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_14.png\" alt=\"Bubble Sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_14.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_14-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_14-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_14-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_23.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96593\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_23.png\" alt=\"Bubble Sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_23.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_23-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_23-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_23-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_32.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96594\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_32.png\" alt=\"Bubble sorting\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_32.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_32-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_32-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_32-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_20.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96595\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_20.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_20.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_20-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_20-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_20-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_9-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96596\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_9-1.png\" alt=\"Bubble sort working\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_9-1.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_9-1-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_9-1-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_9-1-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_27.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96597\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_27.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_27.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_27-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_27-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_27-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_22.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96598\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_22.png\" alt=\"Bubble sorting\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_22.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_22-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_22-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_22-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<h5>ITERATION 3<\/h5>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_29.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96600\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_29.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_29.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_29-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_29-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_29-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_19.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96601\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_19.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_19.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_19-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_19-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_19-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_21.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96602\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_21.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_21.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_21-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_21-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_21-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_2-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96603\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_2-1.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_2-1.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_2-1-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_2-1-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_2-1-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_16.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96604\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_16.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_16.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_16-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_16-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_16-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96605\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_11.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_11.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_11-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_11-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_11-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h5>ITERATION 4<\/h5>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_30.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96606\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_30.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_30.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_30-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_30-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_30-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_28.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96607\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_28.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_28.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_28-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_28-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_28-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_7-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96608\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_7-1.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_7-1.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_7-1-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_7-1-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_7-1-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_12.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96609\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_12.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_12.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_12-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_12-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_12-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_17.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96610\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_17.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_17.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_17-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_17-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_17-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<h5>ITERATION 5<\/h5>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96611\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96612\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_15.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96613\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_15.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_15.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_15-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_15-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_15-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_6-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96614\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_6-1.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_6-1.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_6-1-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_6-1-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_6-1-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<h5>ITERATION 6<\/h5>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96611\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96612\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_15.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96613\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_15.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_15.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_15-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_15-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_15-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<h5>ITERATION 7<\/h5>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96611\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96612\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_18-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h5>ITERATION 8<\/h5>\n<h3><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96611\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2.png\" alt=\"Bubble sort\" width=\"402\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble_Sort_4-2-320x77.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/h3>\n<h3>Stability of Bubble sort algorithm<\/h3>\n<p>The stability of sorting algorithms comes into the picture when the same element is present more than once in a dataset. If the same elements in the unsorted dataset appear in the same order in the sorted dataset, then the algorithm is said to be a stable algorithm.<\/p>\n<p>In the above example, the letter \u2018A\u2019 appears three times in the original array in the order RED, GREEN, and YELLOW. In the final sorted array after iteration 8, the order of A\u2019s is the same as in the original. Hence, we can say that bubble sort is a stable sorting algorithm.<\/p>\n<h4>Implementation of Bubble sort in C<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\n\r\nvoid main() \r\n{\r\n   int arr[] = {34,8,25,45,13,70,54,68,100,3,92,86};\r\n  \r\n   int len = 12;\r\n for (int i = 0; i &lt; len - 1; i++) \r\n  {\r\n      \r\n    for (int j = 0; j &lt; len - i - 1; j++) \r\n    {\r\n    \r\n      if (arr[j] &gt; arr[j + 1]) \r\n      {\r\n      \r\n       int temp = arr[j];\r\n        arr[j] = arr[j + 1];\r\n        arr[j + 1] = temp;\r\n      }\r\n    }\r\n  }\r\n  printf(\"Sorted Array:\\n\");\r\n   for (int i = 0; i &lt; len - 1; i++) \r\n  {\r\n      printf(\"%d \",arr[i]);\r\n  }\r\n}\r\n<\/pre>\n<h4>Bubble sort Implementation in C++<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\nusing namespace std;\r\n\r\nint main() \r\n{\r\n   int arr[] = {34,8,25,45,13,70,54,68,100,3,92,86};\r\n  \r\n   int len = 12;\r\n for (int i = 0; i &lt; len - 1; i++) \r\n  {\r\n      \r\n    for (int j = 0; j &lt; len - i - 1; j++) \r\n    {\r\n    \r\n      if (arr[j] &gt; arr[j + 1]) \r\n      {\r\n      \r\n       int temp = arr[j];\r\n        arr[j] = arr[j + 1];\r\n        arr[j + 1] = temp;\r\n      }\r\n    }\r\n  }\r\n  cout &lt;&lt; \"Sorted Array:\\n\";\r\n   for (int i = 0; i &lt; len - 1; i++) \r\n  {\r\n      cout &lt;&lt; \" \" &lt;&lt; arr[i];\r\n  }\r\n}\r\n<\/pre>\n<h4>Bubble sort Implementation in Java<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">public class Bubblesort \r\n{\r\n  static void bubbleSort(int arr[]) \r\n  {\r\n      int i,j,len;\r\n      len = arr.length;\r\n      Boolean swap;\r\n    for (i = 0; i &lt; len - 1; i++)\r\n{\r\n      for (j = 0; j &lt; len - i - 1; j++)\r\n{\r\n        if (arr[j] &gt; arr[j + 1]) \r\n        {\r\n          int temp = arr[j];\r\n          arr[j] = arr[j + 1];\r\n          arr[j + 1] = temp;\r\n        }\r\n      \r\n    }\r\n}\r\nSystem.out.println(\"Sorted Array:\");\r\n\r\n      for (i = 0; i &lt; len - 1; i++)\r\n      System.out.print(arr[i]+\" \");\r\n  }\r\n\r\n  public static void main(String args[]) \r\n  {\r\n      \r\n    int[] data = {34,8,25,45,13,70,54,68,100,3,92,86 };\r\n    Bubblesort.bubbleSort(data);\r\n  }\r\n}\r\n<\/pre>\n<h4>Implementation of Bubble sort in Python<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def bubbleSort(array):\r\n   \r\n  for i in range(len(array)):\r\n\r\n    for j in range(0, len(array) - i - 1):\r\n\r\n      if array[j] &gt; array[j + 1]:\r\n\r\n        temp = array[j]\r\n        array[j] = array[j+1]\r\n        array[j+1] = temp\r\n\r\n\r\ndata = [34,8,25,45,13,70,54,68,100,3,92,86]\r\n\r\nbubbleSort(data)\r\n\r\nprint('Sorted Array:')\r\nprint(data)\r\n<\/pre>\n<h3>Optimized Bubble sort<\/h3>\n<p>In the example we discussed above, you can clearly see that even if the array is sorted, all the comparisons and iterations are still performed. This results in higher execution time, and more comparisons that are useless since the array is already sorted. The last swap in the above example is done in iteration 4. But still, the program continues to compare until iteration 8 which is useless and inefficient.<\/p>\n<p>To counter this problem, we introduce a binary variable that is set to a false value. If even one swap is made in the array during sorting, it changes to true, else it remains false. If after any iteration, it is not changed, then the array is sorted and no need for further comparisons.<\/p>\n<p>In the above example, if we apply optimized bubble sort, then the execution will be stopped after iteration 5 since no swap is made there.<\/p>\n<h4>Algorithm of Optimized Bubble Sort<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Step 1: Repeat For i = 0 to N-1\r\n             Swap = false\r\nStep 2: Repeat For j = i + 1 to N - I\r\nStep 3: If Arr[ j ] &gt; Arr[ i ]\r\n             swap Arr[ j ] and Arr[ i ]\r\n             swap = true\r\n             [end of step 2]\r\n             If swap == false\r\n             Goto step 4\r\n             [end of step 1]\r\nStep 4: stop\r\n<\/pre>\n<h4>Optimized Bubble Sort Pseudocode<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">procedure bubbleSort( array)\r\n\r\n   len = array.length;\r\n   \r\n   for i = 0 to loop-1 do:\r\n      swap =false\t\r\n      for j = 0 to loop-1 do:\r\n        \r\n         if list[j] &gt; list[j+1] then\r\n            swap( list[j], list[j+1] )\t\r\n            swap = true\t \r\n         end if         \r\n      end for \r\n      If swap = = false\r\n      break; \r\n   end for\r\n return array\r\nend procedure\r\n<\/pre>\n<h4>Implementation of Optimized bubble sort in C<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\n\r\nvoid main() \r\n{\r\n   int arr[] = {34,8,25,45,13,70,54,68,100,3,92,86};\r\n  \r\n   int len = 12, swap;\r\n for (int i = 0; i &lt; len - 1; i++) \r\n  {\r\n      swap=0;\r\n    for (int j = 0; j &lt; len - i - 1; j++) \r\n    {\r\n    \r\n      if (arr[j] &gt; arr[j + 1]) \r\n      {\r\n      \r\n       int temp = arr[j];\r\n        arr[j] = arr[j + 1];\r\n        arr[j + 1] = temp;\r\n       swap =1;\r\n      }\r\n    }\r\nif (swap == 0)\r\nbreak;\r\n  }\r\n  printf(\"Sorted Array:\\n\");\r\n   for (int i = 0; i &lt; len - 1; i++) \r\n  {\r\n      printf(\"%d \",arr[i]);\r\n  }\r\n}<\/pre>\n<h4>Optimized bubble sort Implementation in C++<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\nusing namespace std;\r\n\r\nint main() \r\n{\r\n   int arr[] = {34,8,25,45,13,70,54,68,100,3,92,86};\r\n  \r\n   int len = 12,swap;\r\n for (int i = 0; i &lt; len - 1; i++) \r\n  {\r\n      swap=0;\r\n    for (int j = 0; j &lt; len - i - 1; j++) \r\n    {\r\n    \r\n      if (arr[j] &gt; arr[j + 1]) \r\n      {\r\n      \r\n       int temp = arr[j];\r\n        arr[j] = arr[j + 1];\r\n        arr[j + 1] = temp;\r\n       swap =1;\r\n      }\r\n    }\r\nif (swap ==0)\r\nbreak;\r\n  }\r\n  cout &lt;&lt; \"Sorted Array:\\n\";\r\n   for (int i = 0; i &lt; len - 1; i++) \r\n  {\r\n      cout &lt;&lt; \" \" &lt;&lt; arr[i];\r\n  }\r\n}\r\n<\/pre>\n<h4>Optimized bubble sort Implementation in Java<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">public class Bubblesort \r\n{\r\n  static void bubbleSort(int arr[]) \r\n  {\r\n      int i,j,len;\r\n      len = arr.length;\r\n      Boolean swap;\r\n    for (i = 0; i &lt; len - 1; i++)\r\n{\r\n      swap = false;\r\n      for (j = 0; j &lt; len - i - 1; j++)\r\n{\r\n        if (arr[j] &gt; arr[j + 1]) \r\n        {\r\n          int temp = arr[j];\r\n          arr[j] = arr[j + 1];\r\n          arr[j + 1] = temp;\r\n          swap = true;\r\n        }\r\n      \r\n    }\r\nif (swap==false)\r\nbreak;\r\n}\r\nSystem.out.println(\"Sorted Array:\");\r\n\r\n      for (i = 0; i &lt; len - 1; i++)\r\n      System.out.print(arr[i]+\" \");\r\n  }\r\n\r\n  public static void main(String args[]) \r\n  {\r\n      \r\n    int[] data = {34,8,25,45,13,70,54,68,100,3,92,86 };\r\n    Bubblesort.bubbleSort(data);\r\n  }\r\n}\r\n}\r\n<\/pre>\n<h4>Implementation of Optimized bubble sort in Python<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def bubbleSort(array):\r\n   \r\n  for i in range(len(array)):\r\n    swap = false\r\n    for j in range(0, len(array) - i - 1):\r\n\r\n      if array[j] &gt; array[j + 1]:\r\n\r\n        temp = array[j]\r\n        array[j] = array[j+1]\r\n        array[j+1] = temp\r\n        swap = true;\r\n    if swap==false:\r\n        break;\r\n\r\ndata = [34,8,25,45,13,70,54,68,100,3,92,86]\r\n\r\nbubbleSort(data)\r\n\r\nprint('Sorted Array:')\r\nprint(data)\r\n<\/pre>\n<h3>Complexity of Bubble Sort<\/h3>\n<p>In Bubble sort, adjacent elements are compared.<\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">iteration<\/span><\/td>\n<td><span style=\"font-weight: 400;\">comparisons<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">(n-1)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">2<\/span><\/td>\n<td><span style=\"font-weight: 400;\">(n-2)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">3<\/span><\/td>\n<td><span style=\"font-weight: 400;\">(n-3)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">n-1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">Total number of comparison :\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">(n-1) + (n-2) + (n-3) \u2026\u2026\u2026. + 1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">= n(n-1)\/2 \u2248 n^<\/span><span style=\"font-weight: 400;\">2<\/span><span style=\"font-weight: 400;\"> \u00a0 ( complexity)\u00a0<\/span><\/p>\n<p><b>Best Case Complexity:<\/b><span style=\"font-weight: 400;\"> When elements are already sorted.<\/span><\/p>\n<p><b>Average Case Complexity:<\/b><span style=\"font-weight: 400;\"> When elements are jumbled i.e. they are neither in ascending or descending order.<\/span><\/p>\n<p><b>Worst Case Complexity:<\/b><span style=\"font-weight: 400;\">\u00a0 When elements are sorted in the opposite of the required order.<\/span><\/p>\n<p><b>Space complexity:<\/b><span style=\"font-weight: 400;\"> One extra variable, temp,\u00a0 is used to swap the variables.<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Scenario<\/b><\/td>\n<td><b>Complexity<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Worst case<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n^<\/span><span style=\"font-weight: 400;\">2<\/span><span style=\"font-weight: 400;\">)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Average case<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Best case<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n^<\/span><span style=\"font-weight: 400;\">2<\/span><span style=\"font-weight: 400;\">)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">space<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(1)<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><b>Advantages of Bubble sort<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">1. Used in computer graphics since it can detect very small errors and can fix it in O(2n) time.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">2. Easy to Understand.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">3. Minimum space requirement as compared to other sorting algorithms.<\/span><\/p>\n<h3><b>Disadvantages of bubble sort<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">1. Not suitable for large datasets.<\/span><\/p>\n<h3><b>Conclusion<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Bubble sort is the easiest sorting algorithm. Bubble sort is a stable algorithm where the order of the same elements remains unchanged. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Though the worst-case complexity of this algorithm does not make this suitable for very large datasets, by using the optimized version of the bubble, the execution time can be improved to some extent for small datasets. We have also seen the working and implementation of the bubble sort algorithm.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever witnessed a car racing tournament? There are multiple laps in a race. While the race is in progress, let\u2019s say team A is in 4th position. Team B is just behind team A&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":96571,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24020],"tags":[24493,2182,24494],"class_list":["post-96533","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-structure-tutorials","tag-bubble-sort","tag-bubble-sort-algorithm","tag-bubble-sort-in-data-structure"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Bubble Sort in Data Structure - DataFlair<\/title>\n<meta name=\"description\" content=\"Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. Learn more.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/bubble-sort\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bubble Sort in Data Structure - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. Learn more.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/bubble-sort\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-14T03:30:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-26T13:59:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble-sort-in-DS.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Bubble Sort in Data Structure - DataFlair","description":"Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. Learn more.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/bubble-sort\/","og_locale":"en_US","og_type":"article","og_title":"Bubble Sort in Data Structure - DataFlair","og_description":"Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. Learn more.","og_url":"https:\/\/data-flair.training\/blogs\/bubble-sort\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-06-14T03:30:33+00:00","article_modified_time":"2021-06-26T13:59:05+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble-sort-in-DS.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/bubble-sort\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/bubble-sort\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"Bubble Sort in Data Structure","datePublished":"2021-06-14T03:30:33+00:00","dateModified":"2021-06-26T13:59:05+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/bubble-sort\/"},"wordCount":851,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/bubble-sort\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble-sort-in-DS.jpg","keywords":["Bubble Sort","Bubble sort algorithm","Bubble Sort in data structure"],"articleSection":["Data Structure Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/bubble-sort\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/bubble-sort\/","url":"https:\/\/data-flair.training\/blogs\/bubble-sort\/","name":"Bubble Sort in Data Structure - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/bubble-sort\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/bubble-sort\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble-sort-in-DS.jpg","datePublished":"2021-06-14T03:30:33+00:00","dateModified":"2021-06-26T13:59:05+00:00","description":"Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. Learn more.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/bubble-sort\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/bubble-sort\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/bubble-sort\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble-sort-in-DS.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Bubble-sort-in-DS.jpg","width":1200,"height":628,"caption":"Bubble sort"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/bubble-sort\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Data Structure Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/data-structure-tutorials\/"},{"@type":"ListItem","position":3,"name":"Bubble Sort in Data Structure"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/96533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=96533"}],"version-history":[{"count":5,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/96533\/revisions"}],"predecessor-version":[{"id":97809,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/96533\/revisions\/97809"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/96571"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=96533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=96533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=96533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}