Merge Sort in Python

Below is the most compact merge sort function that I can come up with in Python

And the following are the unit tests for it

Quick Sort in Python

Below is the most compact implementation of the quick sort algorithm that I could come up with

And below are its unit tests

atoi() in Python

Sometimes in an interview question you might be asked to implement the atoi() function that exists in C. Below is the most compact version of atoi() that I can come up with. atoi() taks an string and converts that to an integer.