: Can anyone tell about concept of complexity. As I am beginner with complexity . Please explain with a sorting algo.
If you had a long list of random numbers like 34 12 56 7689 693 20 347 2 85 93683 etc or whatever and you wanted to sort them you could do this one of a few ways . In order by value ascending or descending.
As 12 is the lowest number you would have this as the 1st nuber in an ascending list.
93683 would be the highest or 1st number out in a descending list.
If you sorted by string method all the numbers starting with a 1 then a 2 etc would come out regardless of how long the number is.
You would look for the lowest number and the highest number and do a loop between them.
See the following articles on "BUBBLE SORT" routines where the next lowest ( or highest item ) "floats like a bubble through a list" to sort a list out>>>
Hope this helps.