GoConqr has a new look! Let us know what you think.

Flashcards

Mergesort

Suhas S English 1 card

Cards in this deck (1)

  1. 1https://www.geeksforgeeks.org/merge-sort/ // Main function that sorts arr[l..r] using // merge() void sort(int arr[], int l, int r) { if (l < r) { // Find the middle point int m = (l+r)/2; // Sort first and second halves sort(arr, l, m); sort(arr , m+1, r); // Merge the sorted halves merge(arr, l, m, r); } }void merge(int arr[], int l, int m, int r)
    {
    // Find sizes of two subarrays to be merged
    int n1 = m - l + 1;
    int n2 = r - m;
    int L[] = new int [n1];
    int R[] = new int [n2];
    /*Copy data to temp arrays*/
    for (int i=0; i

Information

Description
Flashcards on Mergesort, created by Suhas S on 02/06/2018.
Created by
Suhas S
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?