GATE 2013 Comprehensive Information Page @ http://www.codeblocks.info/2012/08/gate-2013.html
"Merge sort (also commonly spelled mergesort) is an O(n log n) comparison-based sorting algorithm. Most implementations produce a stable sort, which means that the implementation preserves the input order of equal elements in the sorted output. Merge sort is a divide and conquer algorithm that was invented by John von Neumann in 1945." - Wikipedia
Related articles
Quick Sort Using Recursion in C
Heapsort in C
Bubble Sort in C
Selection Sort in C
Binary Search in C
Basic Stack Operations in C
inside merge(), while copying over to main array arr[], what happens when arr1[] is exhausted but arr2[] still has elements left? or vice versa?
ReplyDeleteHere u can note that the 2 sorted arrays hav 9999 as their last ele. Hence the case u say wont ever be generated.
Deleteeg arr1={1,2,999}
arr2={3,4,999}
ten to arr[] v first add 1 , 2 from arr1, now i index points to 9999 and v can see tat arr2[j] compared with 9999 will always be less and hence 3, 4 gets added and loop terminates.
can u help me to parallelize the existing implementation using openMp
ReplyDeletegood !!!!!!
ReplyDeletek
ReplyDeletethere are better ways to implement the merge() function...can be done using 1 temporary array only...
ReplyDelete