Shortcut for chapter specific information

Wednesday, May 4, 2011

Merge sort 2 (perl)

I finally wrote my first merge sort.  Even in perl, it requires heavy debugging.  I think this is ok.  Mergesort is significantly more involved than insertion and selection sort.

Here is the summary of what I did wrong in the perl version:
Major problems
-I didn't think through the right termination condition for the merge_sort.
-index was wrong while merging.

Minor problems:
-In perl, declaration of arrays using my, need to be done line-by-line. (Is it true?)

In any case, I think I am ready to write the C version.  In fact, I could assume I only need one more working memory with size N.  That is not tough.   Mr Ching-Kuang Shene's book should give a very good example. I think the more important issue is to think through different variants of merge sort.   That is not easy at all. It's also time to finish 2.3-2.

No comments:

Post a Comment