I got this formula from a data structure book in the bubble sort algorithm.
I know that we are (n-1) * (n times), but why the division by 2?
Can anyone please explain this to me or give the detailed proof for it.
Thank you
See triangle numbers.