Update Template Method

Update the sort algorithm by using Template Method patterns