This is the idea my code used, though I kept track of the start of the array with a pointer and the end with an integer length.
You seem to imply that the median of an array is always a single element (at n1 or n2). Care is necessary when the lengths of the arrays are even. In this case the median is the average of the middle two elements. When you recompute p1,p1,p2,q2, you must account for this. That's where my original code makes a small error. It's not hard to fix, but it needs to be fixed. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---
