Nov-05-2019, 07:32 PM
So now I'm confuse because I though bubble sort is where you compare ADJACENT elements in a list to see which one is greater, and then swap with each other depending on the two value.
So in this case it's; [3, 2, 5, 7, 6, 8]. So is 7, being the 4th position element in this list, is being temporarily store in the variable "temp", i.e. "aList[i+1] = temp", and 3 is being placed in the 4th position? Based on what you're saying the list would look like aList = [2, 5, 3, 7, 6, 8]. Is this what you're saying?
So in this case it's; [3, 2, 5, 7, 6, 8]. So is 7, being the 4th position element in this list, is being temporarily store in the variable "temp", i.e. "aList[i+1] = temp", and 3 is being placed in the 4th position? Based on what you're saying the list would look like aList = [2, 5, 3, 7, 6, 8]. Is this what you're saying?