Seetharaman Venkatasamy wrote:
your condition i < k can easily break since you are using current index and next index(i and i + 1) remember k = array.length
so either change k to length - 1 or condition to i < k - 1 right?
i had changed it to k-1 already but forgot to update, but thats for the help =D
rohit chavan wrote:Won't it be better if you print the array after each iteration, so as to understand how the BUBBLE SORT works???...
how do i do that? i understand bubblesort but i have to make a program that compairs from left to right and right to left and not just right to left like bubblesort. it sorts but idk if it does it how i want it to.