Question: Implement a non-recursive version of merge-sort algorithm using C++. Arrange two nested loops to accomplish this task. The outer loop should provide the size of
Implement a non-recursive version of merge-sort algorithm using C++. Arrange two nested loops to accomplish this task. The outer loop should provide the size of segments for merging. The inner loop should take care of selecting positions of pairs of segments for merging. The inner loop should start at the left edge and move your pairs of segments to the right. Arrange appropriate values of variables left, middle, right, so that sorting is accomplished just by iterating the call merge(a,left,middle,right).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
