

{"id":97043,"date":"2021-06-30T09:00:09","date_gmt":"2021-06-30T03:30:09","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=97043"},"modified":"2021-06-30T21:27:51","modified_gmt":"2021-06-30T15:57:51","slug":"merge-sort","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/merge-sort\/","title":{"rendered":"Merge Sort in Data Structure"},"content":{"rendered":"<p>Suppose you are the head of an examination center. 4000 students are appearing for the examination and you have 50 invigilators at your center. After examination, you collect the answer sheets in random order. Now you have to arrange the sheets in increasing order of their roll numbers.<\/p>\n<p>Arranging 4000 sheets is a very active and time-consuming task for a single person. So you divide these four thousand sheets into 50 invigilators. Each invigilator gets 80 sheets. The invigilator can divide their sets into further 4 subsets of 20 sheets each and assign a person under them to sort each set.<\/p>\n<p>Once each individual set is sorted the sets are combined again and again in a recursive way to get a fully sorted set of answer sheets. This process is highly efficient and very less time-consuming.<\/p>\n<h3>Merge Sort<\/h3>\n<p>The merge sort algorithm is based on the divide and conquer algorithm technique. Merge sort divides the array into two subarrays. It performs this step recursively, sorts them, and then combines them to get a final sorted array.<\/p>\n<p>1. One of the most efficient sorting algorithms is merge sort.<\/p>\n<p>2. Merge sort uses recursion to divide the array into subarrays and sort them.<\/p>\n<h3>Merge Sort Procedure<\/h3>\n<p>1.Divide Array into two sub-array of an equal number of elements.<\/p>\n<p>2. Sort the two sub-arrays recursively. Repeat step 1 for dividing the array upto base case.<\/p>\n<p>3. Combine the sub-arrays recursively to form a single final sorted array<\/p>\n<p><b>Merge Sort Algorithm<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Merge ( array, low, mid, high)\r\nStep 1: set i = low , j = mid + 1, index = 0\r\nStep 2: while (i &lt;= mid) and (j&lt;= high)\r\n             if array[i] &lt; array[j]\r\n             temp[index] = array[i]\r\n              i++\r\n             else\r\n             temp[index] = array[j]\r\n             j++\r\n             [end of if]\r\n             index++\r\n             [end of loop]\r\nStep 3: if i &gt; mid\r\n             while j &lt;= high\r\n             temp[index] = array[j]\r\n             index ++\r\n             j++\r\n             [end of loop]\r\n             else\r\n             while i &lt;= mid\r\n             temp[index] = array[i]\r\n             index++\r\n             i++\r\n             [end of loop]\r\n             [end of if]\r\nStep 4: set k = 0\r\nStep 5: while k &lt; index\r\n            array[k] = temp[k]\r\n            k++\r\n            [end of loop]\r\nStep 6: END\r\nmerge_sort(array, low, high)\r\nStep 1: if low &lt; high\r\n            mid = (low + high)\/2\r\n            call merge_sort (array, low, mid)\r\n            call merge_sort (array, mid + 1, high)\r\n            merge (array, low, mid, high)\r\n            [end of if]\r\nStep 2: END\r\n<\/pre>\n<p><b>Merge Sort Pseudocode<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">procedure mergesort( array )\r\n   if ( n == 1 ) return a\r\n\r\n   subarray1 = a[0] ... a[n\/2]\r\n   subarray2 = a[n\/2+1] ... a[n]\r\n\r\n   subarray1 = mergesort( subarray1 )\r\n   subarray2 = mergesort( subarray2 )\r\n\r\n   return merge( subarray1, subarray2 )\r\nend procedure\r\n\r\nprocedure merge( subarray1, subarray2 )\r\n\r\n   subarray3\r\n   while ( subarray1 and subarray2 are not empty)\r\n      if ( subarray1[0] &gt; subarray2[0] )\r\n         add subarray2[0] to the end of subarray3\r\n         remove subarray2[0] from subarray2\r\n      else\r\n         add subarray1[0] to the end of subarray3\r\n         remove subarray1[0] from subarray1\r\n      end if\r\n   end while\r\n   \r\n   while ( subarray1 is not empty )\r\n      add subarray1[0] to the end of subarray3\r\n      remove subarray1[0] from subarray1\r\n   end while\r\n   \r\n   while ( subarray2 is not empty )\r\n      add subarray2[0] to the end of subarray3\r\n      remove subarray2[0] from subarray2\r\n   end while\r\n   \r\n   return subarray3\r\n  \r\nend procedure\r\n<\/pre>\n<h4>Working of Merge Sort<\/h4>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Merge-Sort.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-97398\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Merge-Sort.png\" alt=\"Merge Sort\" width=\"623\" height=\"436\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Merge-Sort.png 623w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Merge-Sort-300x210.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Merge-Sort-150x105.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Merge-Sort-520x364.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Merge-Sort-320x224.png 320w\" sizes=\"auto, (max-width: 623px) 100vw, 623px\" \/><\/a><\/p>\n<p>We can see in the above example that the order of elements with the same value \u2018A\u2019 does not change in the sorted array. Therefore we can say that merge sort is a stable algorithm.<\/p>\n<h4>Implementation of merge sort in C<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\n\r\nvoid merge(int arr[], int l, int m, int h) \r\n{\r\n\r\n  int sub1 = m - l + 1;\r\n  int sub2 = h - m;\r\n Int i, j;\r\n  int L[sub1], M[sub2];\r\n\r\n  for (i = 0; i &lt; sub1; i++)\r\n    L[i] = arr[l + i];\r\n  for ( j = 0; j &lt; sub2; j++)\r\n    M[j] = arr[m + 1 + j];\r\n\r\n  int i, j, k;\r\n  i = 0;\r\n  j = 0;\r\n  k = l;\r\n\r\n  while (i &lt; sub1 &amp;&amp; j &lt; sub2) \r\n  {\r\n    if (L[i] &lt;= M[j])\r\n    {\r\n      arr[k] = L[i];\r\n      i++;\r\n    } else \r\n    {\r\n      arr[k] = M[j];\r\n      j++;\r\n    }\r\n    k++;\r\n  }\r\n\r\n  while (i &lt; sub1) \r\n  {\r\n    arr[k] = L[i];\r\n    i++;\r\n    k++;\r\n  }\r\n\r\n  while (j &lt; sub2) \r\n  {\r\n    arr[k] = M[j];\r\n    j++;\r\n    k++;\r\n  }\r\n}\r\n\r\nvoid mergeSort(int arr[], int low, int high) \r\n{\r\n  if (low &lt; high) \r\n  {\r\n\r\n    int mid = low + (high - low) \/ 2;\r\n\r\n    mergeSort(arr, low, mid);\r\n    mergeSort(arr, mid + 1, high);\r\n\r\n    merge(arr, low, mid, high);\r\n  }\r\n}\r\n\r\nint main() \r\n{\r\n  int array[] = {31, 67, 53, 9, 26, 17,92, 74, 81, 40};\r\n  int size = sizeof(array) \/ sizeof(array[0]);\r\n\r\n  mergeSort(array, 0, size - 1);\r\n\r\n  printf(\"Sorted array: \\n\");\r\n   for (int i = 0; i &lt; size; i++)\r\n    printf(\"%d \", array[i]);\r\n  \r\n}\r\n<\/pre>\n<h4>Merge Sort implementation in C++<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\nusing namespace std;\r\n\r\nvoid merge(int arr[], int l, int m, int h) \r\n{\r\n\r\n  int sub1 = m - l + 1;\r\n  int sub2 = h - m;\r\n\r\n  int L[sub1], M[sub2];\r\n\r\n  for (int i = 0; i &lt; sub1; i++)\r\n    L[i] = arr[l + i];\r\n  for (int j = 0; j &lt; sub2; j++)\r\n    M[j] = arr[m + 1 + j];\r\n\r\n  int i, j, k;\r\n  i = 0;\r\n  j = 0;\r\n  k = l;\r\n\r\n  while (i &lt; sub1 &amp;&amp; j &lt; sub2) \r\n  {\r\n    if (L[i] &lt;= M[j])\r\n    {\r\n      arr[k] = L[i];\r\n      i++;\r\n    } else \r\n    {\r\n      arr[k] = M[j];\r\n      j++;\r\n    }\r\n    k++;\r\n  }\r\n\r\n  while (i &lt; sub1) \r\n  {\r\n    arr[k] = L[i];\r\n    i++;\r\n    k++;\r\n  }\r\n\r\n  while (j &lt; sub2) \r\n  {\r\n    arr[k] = M[j];\r\n    j++;\r\n    k++;\r\n  }\r\n}\r\n\r\nvoid mergeSort(int arr[], int low, int high) \r\n{\r\n  if (low &lt; high) \r\n  {\r\n\r\n    int mid = low + (high - low) \/ 2;\r\n\r\n    mergeSort(arr, low, mid);\r\n    mergeSort(arr, mid + 1, high);\r\n\r\n    merge(arr, low, mid, high);\r\n  }\r\n}\r\nint main() \r\n{\r\n  int array[] = {31, 67, 53, 9, 26, 17,92, 74, 81, 40};\r\n  int size = sizeof(array) \/ sizeof(array[0]);\r\n\r\n  mergeSort(array, 0, size - 1);\r\n\r\n  cout &lt;&lt; \"Sorted array:\" ;\r\n   for (int i = 0; i &lt; size; i++)\r\n    cout &lt;&lt; \" \" &lt;&lt; array[i];\r\n  \r\n}\r\n<\/pre>\n<h3>Jave Merge Sort Implementation<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">public class MergeSort \r\n{\r\n\r\n  void merge(int arr[], int l, int m, int h) \r\n  {\r\n\r\n    int sub1 = m - l + 1;\r\n    int sub2 = h - m;\r\n\r\n    int L[] = new int[sub1];\r\n    int M[] = new int[sub2];\r\n\r\n    for (int i = 0; i &lt; sub1; i++)\r\n      L[i] = arr[l + i];\r\n    for (int j = 0; j &lt; sub2; j++)\r\n      M[j] = arr[m + 1 + j];\r\n\r\n    int i,j,k;\r\n    i=j=0;\r\n    k=l;\r\n   \r\n    while (i &lt; sub1 &amp;&amp; j &lt; sub2) \r\n    {\r\n      if (L[i] &lt;= M[j]) \r\n      {\r\n        arr[k] = L[i];\r\n        i++;\r\n      } else {\r\n        arr[k] = M[j];\r\n        j++;\r\n      }\r\n      k++;\r\n    }\r\n\r\n    while (i &lt; sub1) \r\n    {\r\n      arr[k] = L[i];\r\n      i++;\r\n      k++;\r\n    }\r\n\r\n    while (j &lt; sub2) {\r\n      arr[k] = M[j];\r\n      j++;\r\n      k++;\r\n    }\r\n  }\r\n\r\n  void mergeSort(int arr[], int low, int high) \r\n  {\r\n    if (low &lt; high) \r\n    {\r\n\r\n      int mid = (low + high) \/ 2;\r\n\r\n      mergeSort(arr, low, mid);\r\n      mergeSort(arr, mid + 1, high);\r\n\r\n      merge(arr, low, mid, high);\r\n    }\r\n  }\r\n\r\n\r\n  public static void main(String args[]) \r\n  {\r\n    int arr[] = { 31, 67, 53, 9, 26, 17,92, 74, 81, 40 };\r\n\r\n    MergeSort ms = new MergeSort();\r\n    ms.mergeSort(arr, 0, arr.length - 1);\r\n\r\n    System.out.println(\"Sorted array:\");\r\n    for (int i = 0; i &lt; arr.length; ++i)\r\n      System.out.print(arr[i] + \" \");\r\n    System.out.println();\r\n  }\r\n}\r\n<\/pre>\n<h3>Implementation of merge sort in Python<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def mergeSort(array):\r\n    if len(array) &gt; 1:\r\n\r\n        r = len(array)\/\/2\r\n        L = array[:r]\r\n        M = array[r:]\r\n        mergeSort(L)\r\n        mergeSort(M)\r\n\r\n        i = j = k = 0\r\n\r\n        while i &lt; len(L) and j &lt; len(M):\r\n            if L[i] &lt; M[j]:\r\n                array[k] = L[i]\r\n                i =i+ 1\r\n            else:\r\n                array[k] = M[j]\r\n                j = j+ 1\r\n            k =k+ 1\r\n\r\n        while i &lt; len(L):\r\n            array[k] = L[i]\r\n            i += 1\r\n            k += 1\r\n\r\n        while j &lt; len(M):\r\n            array[k] = M[j]\r\n            j += 1\r\n            k += 1\r\n\r\n\r\n\r\nif __name__ == '__main__':\r\n    array = [31, 67, 53, 9, 26, 17,92, 74, 81, 40]\r\n\r\n    mergeSort(array)\r\n\r\n    print(\"Sorted array: \")\r\n    for i in range(len(array)):\r\n        print(array[i], end=\" \")\r\n<\/pre>\n<h3>Complexity of Merge Sort<\/h3>\n<table>\n<tbody>\n<tr>\n<td><\/td>\n<td><b>scenario<\/b><\/td>\n<td><b>complexity<\/b><\/td>\n<\/tr>\n<tr>\n<td rowspan=\"3\"><b>Time Complexity<\/b><\/td>\n<td><span style=\"font-weight: 400;\">Average case<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n log n)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Best case<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n log n)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Worst case<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n log n)<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>Space complexity<\/b><\/td>\n<td><\/td>\n<td><span style=\"font-weight: 400;\">O(n)<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Applications of merge sort<\/h4>\n<p>Merge sort is suitable for non-contiguous data, for example, linked list. Merge sort implementation in linked lists yields efficient results.<br \/>\nExternal merge sort algorithm for sorting massive data on systems with less memory.<br \/>\nCount inversions in an array. It is the count of steps that we need to sort the array.<\/p>\n<h4>Disadvantages of merge sort<\/h4>\n<p>Merge sort is not efficient if the array is already sorted. It has the same time complexity for the best and worst-case<br \/>\nIn the case of small datasets, it is slower than other sorting techniques.<br \/>\nIt requires additional memory equivalent to the size of the dataset.<\/p>\n<h3>Conclusion<\/h3>\n<p>Merge sort is one of the most efficient sorting techniques used in the real world. It is best suitable for large datasets, but for small datasets, it is less efficient than other prominent sorting techniques. The divide and conquer approach is one of the most efficient algorithm techniques for approaching a problem. We also discussed the working and implementation of merge sort in different programming languages.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Suppose you are the head of an examination center. 4000 students are appearing for the examination and you have 50 invigilators at your center. After examination, you collect the answer sheets in random order.&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":97400,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24020],"tags":[24615,24617,24618,24616],"class_list":["post-97043","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-structure-tutorials","tag-merge-sort","tag-merge-sort-algorithm","tag-merge-sort-applications","tag-merge-sort-in-data-structure"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Merge Sort in Data Structure - DataFlair<\/title>\n<meta name=\"description\" content=\"The merge sort algorithm is based on the divide and conquer algorithm technique. Merge sort divides the array into two subarrays.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/merge-sort\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Merge Sort in Data Structure - DataFlair\" \/>\n<meta property=\"og:description\" content=\"The merge sort algorithm is based on the divide and conquer algorithm technique. Merge sort divides the array into two subarrays.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/merge-sort\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-30T03:30:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-30T15:57:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/merge-sort-in-DS.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Merge Sort in Data Structure - DataFlair","description":"The merge sort algorithm is based on the divide and conquer algorithm technique. Merge sort divides the array into two subarrays.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/merge-sort\/","og_locale":"en_US","og_type":"article","og_title":"Merge Sort in Data Structure - DataFlair","og_description":"The merge sort algorithm is based on the divide and conquer algorithm technique. Merge sort divides the array into two subarrays.","og_url":"https:\/\/data-flair.training\/blogs\/merge-sort\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-06-30T03:30:09+00:00","article_modified_time":"2021-06-30T15:57:51+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/merge-sort-in-DS.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/merge-sort\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/merge-sort\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"Merge Sort in Data Structure","datePublished":"2021-06-30T03:30:09+00:00","dateModified":"2021-06-30T15:57:51+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/merge-sort\/"},"wordCount":504,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/merge-sort\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/merge-sort-in-DS.jpg","keywords":["Merge Sort","Merge Sort algorithm","Merge Sort applications","Merge Sort in data structure"],"articleSection":["Data Structure Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/merge-sort\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/merge-sort\/","url":"https:\/\/data-flair.training\/blogs\/merge-sort\/","name":"Merge Sort in Data Structure - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/merge-sort\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/merge-sort\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/merge-sort-in-DS.jpg","datePublished":"2021-06-30T03:30:09+00:00","dateModified":"2021-06-30T15:57:51+00:00","description":"The merge sort algorithm is based on the divide and conquer algorithm technique. Merge sort divides the array into two subarrays.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/merge-sort\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/merge-sort\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/merge-sort\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/merge-sort-in-DS.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/merge-sort-in-DS.jpg","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/merge-sort\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Data Structure Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/data-structure-tutorials\/"},{"@type":"ListItem","position":3,"name":"Merge Sort in Data Structure"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/97043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=97043"}],"version-history":[{"count":4,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/97043\/revisions"}],"predecessor-version":[{"id":97401,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/97043\/revisions\/97401"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/97400"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=97043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=97043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=97043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}