Fixed semaphore code.
Fixed comparison function for reference qsort. Indentation fix.
Added simple insertion sort. Indentation fix.