Sorting algorithms and Big O notation challenges