Fast parallel algorithms for sorting and median finding