1 / 6

231 likes | 504 Views

BUBBLE SORT. It is also known as sinking sort. It is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. Ascending Sort.

Download Presentation
## BUBBLE SORT

**An Image/Link below is provided (as is) to download presentation**
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.
Content is provided to you AS IS for your information and personal use only.
Download presentation by click this link.
While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

**It is also known as sinking sort.It is a simple sorting**algorithm that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order.**Ascending Sort.**First Pass:( 51 4 2 8 ) ( 15 4 2 8 ), Here, algorithm compares the first two elements, and swaps them. ( 1 54 2 8 ) ( 1 45 2 8 ), Swap since 5 > 4 ( 1 4 52 8 ) ( 1 4 25 8 ), Swap since 5 > 2 ( 1 4 2 58 ) ( 1 4 2 58 ), Now, since these elements are already in order (8 > 5), algorithm does not swap them.**Second Pass:( 1 4 2 5 8 ) ( 1 4 2 5 8 )( 1 4 2 5**8 ) ( 1 2 4 5 8 ), Swap since 4 > 2( 1 2 4 5 8 ) ( 1 2 4 5 8 )( 1 2 4 5 8 ) ( 1 2 4 5 8 )Third Pass:( 1 2 4 5 8 ) ( 1 2 4 5 8 )( 1 2 4 5 8 ) ( 1 2 4 5 8 )( 1 2 4 5 8 ) ( 1 2 4 5 8 )( 1 2 4 5 8 ) ( 1 2 4 5 8 )

More Related