Question: Can someone explain to me how i can split an array of integers for mergse sort? I'm having trouble visualizing and creating this. Example arrayInt

Can someone explain to me how i can split an array of integers for mergse sort? I'm having trouble visualizing and creating this.

Example arrayInt = {5, 2, 4, 3, 1}

split 1 = leftArray = {5, 2, 4}; rightArray = {3, 1}

split 2 = leftArray = {5, 2}, {4}; rightArray = {3}, {1}

split 3 = leftArray = {5}, {2}, {4};

Do i need to create 3 arrays, I've seen implententations where they use only two arrays but i can't fully grasp it. I don't understand how they can keep spliting an array.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!