added some common Sorting algos

addes some refactoring too.