Bubble Sort Useing Python 2.7
Strategy To be use to write python code
Bubble Sort is simple sorting Algorithm which wark step by step sorting according to the passes or iteration
Rules to sort
- Number of iteration or passes is to be done is eqal to number of element in the list
- Compare each pare of adjesent two numbers
- Swaps them untill the no swaps are needed
Strategy To be use to write python code
- Use list to take input
- Append is python define list function
- For loop of "X" varible is to number of passes or iteration
- For loopof "XX" is for no of sorting in single pass to be done
Pyhton Program using class is little bit large but easy to understand.
- Class Name of "sortAlgo" is use .
- Many Function is use to make program simple to understand.
- "__init__" is constracter used to define empty List "o_list"
No comments:
Post a Comment