Hello coders, newbie on board!
Just a quick question: How do I calculate the number of steps a bubble sort takes to sort a database of n entries?
On my notes it is written that "It is easy to see that a bubble sort of n records requires n−1 comparisons on the first pass, n−2 on the second and so on down for a total of n−1 passes" but I don't really understand it. Neither the conclusion itself, nor how the guy came to that conclusion.
I'd appreciate it if you could explain me the mathematics behind it, I don't want the answer, I want the way to the answer. :)
Thanks in advance!