sorting method from answer key
adding recursion sample from book