I cant understand bubble sort(the code is given above). How is j and k used. In the for loop why is [ j = 1 : n-k ]. What does fewer tests on each pass mean. And I cant understand how temp is used to switch two numbers in x. And why is sorter reset to 0 after each for loop. Can someone explain this part by part? I only get the basic idea of how two numbers are compared and then replaced (or not) but how is it checked. Which two numbers are chosen first?
MATLAB: Can someone help me understand bubble sort.
bubblebubble sortforfor loophomeworkMATLABsort
Best Answer