Insert sort function for weekly programming ex04.