QuesHub > 情况 > 最差 > 分量 > ASK DETAIL

Why merge sort is n log n?

Julian Carter | 2018-06-17 12:09:49 | page views:1082
I'll answer
Earn 20 gold coins for an accepted answer.20 Earn 20 gold coins for an accepted answer.
40more

Jacob Morris

Works at Tesla, Lives in Austin. Graduated from Texas A&M University with a degree in Mechanical Engineering.
This is because whether it be worst case or average case the merge sort just divide the array in two halves at each stage which gives it lg(n) component and the other N component comes from its comparisons that are made at each stage. So combining it becomes nearly O(nlg n).Oct 18, 2011

Evelyn Baker

QuesHub.com delivers expert answers and knowledge to you.
This is because whether it be worst case or average case the merge sort just divide the array in two halves at each stage which gives it lg(n) component and the other N component comes from its comparisons that are made at each stage. So combining it becomes nearly O(nlg n).Oct 18, 2011
ask:3,asku:1,askr:137,askz:21,askd:152,RedisW:0askR:3,askD:0 mz:hit,askU:0,askT:0askA:4