Tuesday, June 30, 2020

The Bubble Sort


The program given below using the “while” loop.













Output is




The Bubble Sort – Interactive Version

Python, however, has its own sorting mechanisms. No one needs to write their own sorts, as there is a sufficient number of ready-to-use tools.

See the below examples.

Example -1






Output is



All the lists have a method named “sort ()” which sorts them as fast as possible.

Example -2


















Output is














reverse () Method

Example -1




Output is






Example -2











Output is


No comments:

Post a Comment