![]() |
VOOZH | about |
Given a singly linked list, sort it using bubble sort. 👁 sorting image
Input : 10->30->20->5 Output : 5->10->20->30 Input : 20->4->3 Output : 3->4->20
Output:
Linked list before sorting 90 1 11 2 56 12 Linked list after sorting 1 2 11 12 56 90
Time Complexity: O(n2)
Auxiliary Space: O(1)