Why is mege sort O(n log n)?
Example, n is 8. Merge sort (for link list) is constantly divide the list into two sublist until every node->next will point to null. Then, sort them by merging them. When I tried to count it myself, in the divide part first divide the 8 nodes into two. In link list, you will need to traverse....
__________________
C++
domain name forum
|