

{"id":97795,"date":"2021-07-02T09:00:54","date_gmt":"2021-07-02T03:30:54","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=97795"},"modified":"2021-06-26T21:44:17","modified_gmt":"2021-06-26T16:14:17","slug":"shell-sort","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/shell-sort\/","title":{"rendered":"Shell Sort in Data Structure"},"content":{"rendered":"<p>Shell sort is one of the highly efficient algorithms. It is based on the insertion sort technique. The major difference between insertion sort and shell sort is that shell sort avoids large shifts of the elements. Shell sort first sorts the elements that are far and continuously keeps on decreasing the interval between the far elements.<\/p>\n<p>The space between the far elements is called interval. Interval for the shell sort is calculated by various methods.<\/p>\n<h3>Interval calculation in Shell Sort<\/h3>\n<p>Interval in shell sort can be reduced by using the optimal sequence. Some optimal sequences that can be used in shell sort are:<\/p>\n<ul>\n<li>Shell\u2019s original sequence: N\/2, N\/4, \u2026. 1<\/li>\n<li>Knuth\u2019s Sequence: 1, 4, 13, \u2026.., (3n &#8211; 1) \/ 2<\/li>\n<li>Sedgwick\u2019s sequence: 1,8,23,77,281,1073,4193,16577\u2026 4j+1+3.2j+1<\/li>\n<li>Hibbard\u2019s sequence: 1,3,7,15,31,63,127,255,511\u2026.<\/li>\n<li>Papernov &amp; Stasevich sequence: 1,3,5,9,17,33,65,&#8230;.<\/li>\n<li>Pratt: 1,2,3,4,6,9,8,12,18,27,16,24,36,54,81,&#8230;<\/li>\n<\/ul>\n<h3>Shell Sort Procedure<\/h3>\n<p>1. Sort the columns by using insertion sort after arranging the elements in the tabular form<br \/>\n2. Repeat Step 1 with a smaller number of longer columns each time. Do this in such a way that at the end, only one column of data is left to be sorted.<\/p>\n<h3>Shell Sort Algorithm Steps<\/h3>\n<p>1: set flag = 1, interval = n<br \/>\n2: while flag = 1 or interval &gt; 1<br \/>\n3: set flag = 0<br \/>\n4: set interval = (interval + 1) \/ 2<br \/>\n5: for i = 0 to i &lt; (n &#8211; interval)<br \/>\n6: if array[i + interval] &gt; array[i]<br \/>\nswap array[i + interval], array[i]<br \/>\nset flag = 0<br \/>\n[End of for]<br \/>\n[End of while]<br \/>\n7: Stop<\/p>\n<h3>Pseudocode for Shell Sort<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">procedure Shellsort(array)\r\n\r\n   while interval &lt; array.length \/3 do:\r\n      interval = interval * 3 + 1\t    \r\n   end while\r\n   \r\n   while interval &gt; 0 \r\n\r\n      for out = interval; out &lt; array.length; out ++ \r\n      \r\n      insertValue = array[out]\r\n      inner = out;\r\n\r\n         while inner &gt; interval -1 &amp;&amp; array[inner - interval] &gt;=   insertValue \r\n            array[inner] = array[inner - interval]\r\n            inner = inner - interval\r\n         end while\r\n\r\n         array[inner] = insertValue\r\n\r\n      end for\r\n\r\n      interval = (interval -1) \/3;\t  \r\n\r\n   end while\r\n   \r\nend procedure<\/pre>\n<h3>Working of shell sort<\/h3>\n<p>Let\u2019s sort the characters in the word \u201cDATAFLAIR\u201d by the bubble sort technique.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shell-Sort-Example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-97815\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shell-Sort-Example.png\" alt=\"Shell Sort Example\" width=\"402\" height=\"42\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shell-Sort-Example.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shell-Sort-Example-320x33.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p>We will be using knuth\u2019s sequence for interval:<\/p>\n<p>Interval = integer (N\/2) = integer (9\/2) = 4<\/p>\n<p>Iteration 1: Divide the array into subarray containing no. of elements = interval<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shell-Sort-Iteration-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-97816\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shell-Sort-Iteration-1.png\" alt=\"Shell Sort Iteration 1\" width=\"402\" height=\"259\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shell-Sort-Iteration-1.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shell-Sort-Iteration-1-320x206.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p>Iteration 2: swap the elements with their corresponding elements as shown above<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shellsort-Iteration2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-97817\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shellsort-Iteration2.png\" alt=\"Shellsort Iteration2\" width=\"402\" height=\"259\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shellsort-Iteration2.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shellsort-Iteration2-320x206.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p>Iteration 3: update interval value to 1<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shellsort-Iteration3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-97818\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shellsort-Iteration3.png\" alt=\"Shellsort Iteration3\" width=\"402\" height=\"157\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shellsort-Iteration3.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shellsort-Iteration3-320x125.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p>Iteration 4: swap the elements with their corresponding elements as shown above<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shellsort-Iteration-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-97819\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shellsort-Iteration-4.png\" alt=\"Shellsort Iteration 4\" width=\"399\" height=\"159\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shellsort-Iteration-4.png 399w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Shellsort-Iteration-4-320x128.png 320w\" sizes=\"auto, (max-width: 399px) 100vw, 399px\" \/><\/a><\/p>\n<p>Iteration 5: sort the remaining array using insertion sort<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Iteration-5-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-97820\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Iteration-5-1.png\" alt=\"Iteration 5\" width=\"402\" height=\"100\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Iteration-5-1.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Iteration-5-1-320x80.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Iteration-6-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-97821\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Iteration-6-1.png\" alt=\"Iteration 6\" width=\"402\" height=\"100\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Iteration-6-1.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Iteration-6-1-320x80.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p>Final sorted array:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Final_Shellsort.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-97822\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Final_Shellsort.png\" alt=\"Final Shellsort\" width=\"402\" height=\"42\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Final_Shellsort.png 402w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/Final_Shellsort-320x33.png 320w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<p>We can clearly see that the order of elements with the same value \u2018A\u2019 is changed in the final sorted array in the above example. Therefore, shell sort is not <strong>a stable algorithm<\/strong>.<\/p>\n<h3>Shell Sort Implementation in C<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\n\r\nvoid ShellSort(int array[], int len) \r\n{\r\n  for (int interval = len \/ 2; interval &gt; 0; interval = interval\/2) \r\n  {\r\n    for (int i = interval; i &lt; len; i =i+ 1) \r\n    {\r\n      int temp = array[i];\r\n      int j;\r\n      for (j = i; j &gt;= interval &amp;&amp; array[j - interval] &gt; temp; j -= interval) \r\n      {\r\n        array[j] = array[j - interval];\r\n      }\r\n      array[j] = temp;\r\n    }\r\n  }\r\n}\r\n\r\nint main() \r\n{\r\n  int array[] = {21, 3, 49, 82, 91, 36, 61, 77,53};\r\n  int len = sizeof(array) \/ sizeof(array[0]);\r\n  ShellSort(array, len);\r\n  printf(\"Sorted array: \\n\");\r\n   for (int i = 0; i &lt; len; ++i) \r\n   {\r\n    printf(\"%d  \", array[i]);\r\n  }\r\n}\r\n<\/pre>\n<h3>Implementation of Shell Sort in C++<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;iostream&gt;\r\nusing namespace std;\r\n\r\nvoid ShellSort(int array[], int len) \r\n{\r\n  for (int interval = len \/ 2; interval &gt; 0; interval = interval\/2) \r\n  {\r\n    for (int i = interval; i &lt; len; i =i+ 1) \r\n    {\r\n      int temp = array[i];\r\n      int j;\r\n      for (j = i; j &gt;= interval &amp;&amp; array[j - interval] &gt; temp; j -= interval) \r\n      {\r\n        array[j] = array[j - interval];\r\n      }\r\n      array[j] = temp;\r\n    }\r\n  }\r\n}\r\n\r\nint main() \r\n{\r\n  int array[] = {21, 3, 49, 82, 91, 36, 61, 77,53};\r\n  int len = sizeof(array) \/ sizeof(array[0]);\r\n  ShellSort(array, len);\r\n  cout &lt;&lt; \"Sorted array:\" ;\r\n   for (int i = 0; i &lt; len; ++i) \r\n   {\r\n    cout &lt;&lt; \" \" &lt;&lt; array[i];\r\n  }\r\n}\r\n<\/pre>\n<h3>Shell Sort Implementation in JAVA<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import java.util.Arrays;\r\n\r\npublic class ShellSort \r\n{\r\n  void shellSort(int array[], int len) \r\n  {\r\n  for (int interval = len \/ 2; interval &gt; 0; interval = interval \/ 2) \r\n  {\r\n    for (int i = interval; i &lt; len; i = i+ 1) \r\n    {\r\n    int temp = array[i];\r\n    int j;\r\n    for (j = i; j &gt;= interval &amp;&amp; array[j - interval] &gt; temp; j = j- interval) \r\n    {\r\n      array[j] = array[j - interval];\r\n    }\r\n    array[j] = temp;\r\n    }\r\n  }\r\n  System.out.println(\"Sorted Array: \");\r\n  for (int i=0;i&lt;len;i++)\r\n  System.out.print(array[i]+\" \");\r\n  }\r\n  \r\n  public static void main(String args[]) \r\n  {\r\n  int[] array = { 21, 3, 49, 82, 91, 36, 61, 77,53 };\r\n  int len = array.length;\r\n  ShellSort ss = new ShellSort();\r\n  ss.shellSort(array, len);\r\n  }\r\n}<\/pre>\n<h3>Implementation of Shell Sort in Python<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def shellSort(array, n):\r\n    \r\n    interval = n \/\/ 2\r\n    while interval &gt; 0:\r\n        for i in range(interval, n):\r\n            temp = array[i]\r\n            k = i\r\n            while k &gt;= interval and array[k - interval] &gt; temp:\r\n                array[k] = array[k - interval]\r\n                k = k -  interval\r\n\r\n            array[k] = temp\r\n        interval =interval \/\/ 2\r\n\r\n\r\narray = [21, 3, 49, 82, 91, 36, 61, 77,53]\r\nsize = len(array)\r\nshellSort(array, size)\r\nprint('Sorted Array:')\r\nprint(array)\r\n<\/pre>\n<h3>Complexity of Shell Sort<\/h3>\n<table style=\"height: 248px;\" width=\"730\">\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(<\/span><span style=\"font-weight: 400;\">n log n<\/span><span style=\"font-weight: 400;\">)<\/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(<\/span><span style=\"font-weight: 400;\">n<\/span><sup><span style=\"font-weight: 400;\">2<\/span><\/sup><span style=\"font-weight: 400;\">)<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>Space complexity<\/b><\/td>\n<td><\/td>\n<td><span style=\"font-weight: 400;\">O(1)<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Applications of shell sort<\/h3>\n<p>Shell sort is used:<\/p>\n<ul>\n<li>To call a stack user head<\/li>\n<li>When recursion exceeds the limit<\/li>\n<li>Shell sort reduces the space between elements having close value. More beneficial than insertion sort.<\/li>\n<\/ul>\n<h3>Conclusion<\/h3>\n<p>Shell sort is one the most efficient sorting algorithm for large datasets. This technique is based on insertion sort but it reduces the no. of swaps considerably. Shell sort does not require extra memory which makes it an overall efficient algorithm for sorting. In the working of shell sort, we proved that shell sort is not a stable sorting algorithm.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Shell sort is one of the highly efficient algorithms. It is based on the insertion sort technique. The major difference between insertion sort and shell sort is that shell sort avoids large shifts of&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":97823,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24020],"tags":[24680,24681,24682,24683],"class_list":["post-97795","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-structure-tutorials","tag-shell-sort","tag-shell-sort-algorithm","tag-shell-sort-pseudo-code","tag-shell-sort-working"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Shell Sort in Data Structure - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn about Shell sort which does not require extra memory and makes it an overall efficient algorithm for sorting. See working &amp; algorithm.\" \/>\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\/shell-sort\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Shell Sort in Data Structure - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn about Shell sort which does not require extra memory and makes it an overall efficient algorithm for sorting. See working &amp; algorithm.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/shell-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-07-02T03:30:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/shell-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=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Shell Sort in Data Structure - DataFlair","description":"Learn about Shell sort which does not require extra memory and makes it an overall efficient algorithm for sorting. See working & algorithm.","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\/shell-sort\/","og_locale":"en_US","og_type":"article","og_title":"Shell Sort in Data Structure - DataFlair","og_description":"Learn about Shell sort which does not require extra memory and makes it an overall efficient algorithm for sorting. See working & algorithm.","og_url":"https:\/\/data-flair.training\/blogs\/shell-sort\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-07-02T03:30:54+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/shell-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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/shell-sort\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/shell-sort\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9"},"headline":"Shell Sort in Data Structure","datePublished":"2021-07-02T03:30:54+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/shell-sort\/"},"wordCount":490,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/shell-sort\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/shell-sort-in-DS.jpg","keywords":["Shell Sort","Shell Sort Algorithm","Shell Sort Pseudo code","Shell Sort Working"],"articleSection":["Data Structure Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/shell-sort\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/shell-sort\/","url":"https:\/\/data-flair.training\/blogs\/shell-sort\/","name":"Shell Sort in Data Structure - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/shell-sort\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/shell-sort\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/shell-sort-in-DS.jpg","datePublished":"2021-07-02T03:30:54+00:00","description":"Learn about Shell sort which does not require extra memory and makes it an overall efficient algorithm for sorting. See working & algorithm.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/shell-sort\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/shell-sort\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/shell-sort\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/shell-sort-in-DS.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/shell-sort-in-DS.jpg","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/shell-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":"Shell 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\/b49855299264df5e27e3ec6c2cd9fde9","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team is a group of passionate educators and industry experts dedicated to providing high-quality online learning resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With years of experience in the field, the team aims to simplify complex topics and help learners advance their careers. At DataFlair, we believe in empowering students and professionals with the knowledge and skills needed to thrive in today\u2019s fast-paced tech industry. Follow us for Free courses, expert insights, tutorials, and practical tips to boost your learning journey.","url":"https:\/\/data-flair.training\/blogs\/author\/datafbdad\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/97795","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=97795"}],"version-history":[{"count":2,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/97795\/revisions"}],"predecessor-version":[{"id":97824,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/97795\/revisions\/97824"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/97823"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=97795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=97795"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=97795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}