Why merge sort is n log n?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
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
评论(0)
Helpful(2)
Helpful
Helpful(2)

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