Merge Algorithm

Objective

The objective of this experiment is to demonstrate that merging two sorted lists results in another sorted list containing all the elements from the two given lists.

Experiment Setup

You are provided with two sorted arrays "left" and "right" and your goal is to merge these two arrays to form the "merged" array using the "NEXT" button.

The "NEXT" button replaces the "Left" and "Right" buttons seen in the Merge Strategy experiment. The next button decides the element to be inserted in the "merged" array next.

At any point during the experiment, the arrays can be one of the two states: sorted or unsorted. The sorted arrays will be shown in green color whereas the unsorted arrays will be shown in red color.

Procedure

  1. Click on the "NEXT" button and observe which element gets added to the "merged" list.
  2. Continue until both "left" and "right" arrays are empty.
  3. Observe whether the "merged" array is sorted or not.