this is a weird sorting algorithm I ended up with while trying to implement merge sort I don't know what it is but I was trying to fix a bug and it just started working..?