Just wondering why you would come to a security web site, and make your very first post about a programming algorithm that has nothing to do with security?

www.google.com brought me here when I searched using

'2 way merge sort algorithm' as my search string.

http://www.brpreiss.com/books/opus4/html/page512.html

Nice little templatized merge sort function it seems.