mergesort - Why is merge sort's worst case still n log n? -


it question on final took earlier , had no idea how answer it.

well was

what merge sort's worst case runtime more importantly, why?

the divide-and-conquer contributes log(n) factor. divide array in half log(n) times, , each time do, each segment, have merge on 2 sorted array. merging 2 sorted arrays o(n). algorithm walk 2 arrays, , walk 1 that's lagging.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -