Implement a custom sorting algorithm and explain its time complexity without using standard library shortcuts.