Talk:Algorithms/Divide and Conquer

Shouldn't a binary search be introduced before a merge sort, since a merge sort is basically a binary search used for sorting.

I also think that heap and quick sorts need to be mentioned a variants of the merge sort.


 * Heap short is covered in Computer Science:Data Structures, since that's where heaps are covered. Pedagogically, I see nothing wrong with covering merge sort first: that's a much better demonstration of the divide and conquer technique than binary search is (that's because DnC has the conquer step, e.g. the merge operation, but there is no real conquer step in binary search, so it's a weaker example; though, it is important to show such cases-- but only after the main point is already understood).


 * Quick sort is covered in the next chapter (which is on randomization). Quick sort is certainly a divide and conquer technique and it's mentioned as such, but I wouldn't go so far as to call it a variant of merge sort. (Nor would I consider a heap sort a merge sort variant-- not variant in the sense of, say, the Shell sort is a variant of the bubble sort.) MShonle 16:39, 10 August 2005 (UTC)

Is the iterative code for MergeSort correct?
Im not seeing this section happen in my head

for i := 1 to n by unit*2 let a1[1..unit] := result[i..i+unit] let a2[1..unit] := result[i+unit..i+unit*2] result[i..i+unit*2] := merge(a1,a2) repeat

Shouldnt the indexes of result array be [2*i...2*i+unit] and [2*i+unit..2*i+unit*2] respectively? Or are the array overlaps intentional?

Removed personal (but probably relevant) comment
I removed a personal remark on the middle of the text, it was contributed by an anonymous editor 10:35, 1 May 2006 59.184.1.252 it could probably refer to this http://www.cs.mcgill.ca/~cs251/ClosestPair/ClosestPairDQ.html page, so if anyone is interested in examining the info and reword it into the text it may be helpful. --Panic (talk) 02:10, 25 January 2010 (UTC)

Use a more modern language
Please, could we update the cod to use a more modern language, or at least something that has some use today? (And this includes C) Seriously, representing the first element of an array as '1'? If we're going to be programming, let's at least use relevant code.