I have been trying to implement Bubble Sort using simple integer array in java.
ID: 3537754 • Letter: I
Question
I have been trying to implement Bubble Sort using simple integer array in java. However there seems to be some problem. Now i know that using ArrayList would be the best option and I would do that too. But why isnt it getting sorted with simple integer array.Here is the code
Its producing the same array as entered. Nothing is getting changed. The difference between a simple array and an ArrayList or Vector ,is just that they offer dynamic time expansion of array size.Is there anything more to it? I mean does simple array creates a different instance every time it is manipulated, just like Strings? It does seem to do so here.
Explanation / Answer
Because you are creating two different BubbleSort Objects, sorting the first one and displaying a different one.
It should have been....
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.