Bubble Sorting
Would someone be able to explain the logic of the bubble sorting? I’ve looked at a few codes demonstrating it but do not yet understand it. My main question derives from the condition in the for loop that does the swapping. Why is it i<the size of the scans MINUS ONE? The minus one is what I do not understand. Wouldn’t you traverse though all of the iterations to swap?? If you do not understand my question, I have the exact area where the confusion is marked in the following code: (The output looks this way because I’m currently coding it replit.com/) https://code.sololearn.com/c1YVZZsdQr7q/?ref=app **UPDATE** For anyone interested, this resource helps clarify things greatly https://stackoverflow.com/questions/12259622/why-bubble-sort-needs-nested-loops/12259766#12259766