Is this code a correct implementation of Bubble Sort?
问题 I am used following bubble sort algorithm for making sorting . Is this algorithm correct? for (int a = itemWiseBidderList.size() - 1; a > 1; a--) { for (int j = 0; j < a; j++) { if ((itemWiseBidderList.get(j).getRankInInt()) > (itemWiseBidderList.get(j + 1).getRankInInt())) { Collections.swap(itemWiseBidderList, j, j + 1); } } } 回答1: If bubble sorting is not a requirement (by homework?), then the correct way to implement sorting in Java is by calling Collections.sort(itemWiseBidderList); If