Can bubble sort work on linked list?
Ngày đăng:
08/01/2022
Trả lời:
0
Lượt xem:
148
I have written a bubble sort algorithm to sort a linked list. I am a Java beginner and trying to learn data structures. I am confused why my second element is not sorted properly. This is the output I am getting Besides I know the worst case scenario of a bubble sort is O(n2). Can I use mergesort on a linked list to have a better time complexity? |