Insertion sort in linked list


what is wrong in this code?

hello @shubhangis248
what issue u r getting

for input 2 1 3 4 5 I am getting output 1 2 4 3 5

once dry run on the same case. it is not performng insertion sort logic.
it is just swaping current data with prev of the list