{"id":15614,"date":"2022-10-12T07:59:50","date_gmt":"2022-10-12T02:29:50","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/"},"modified":"2022-10-12T07:59:50","modified_gmt":"2022-10-12T02:29:50","slug":"solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/","title":{"rendered":"[Solved] How to sort (using strand sort algorithm) an array of integers? C# [closed]"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-24416155\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"24416155\" data-parentid=\"24414470\" data-score=\"2\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>Ok, I got bored and wanted to help (also, a question with that quantity of comments cannot be left without an answer :D), so took the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"http:\/\/en.wikipedia.org\/wiki\/Strand_sort\">Wikipedia PHP implementation<\/a> and converted it to C#, but after a bit the user added he cannot use generics&#8230;<\/p>\n<p>So, I&#8217;m posting a full implementation, one with generics and another with it&#8217;s own LinkedList, it&#8217;s a bit longer but it works (took the Wikipedia example, followed step by step and it behaves exactly as the example table) and it&#8217;s also commented so it&#8217;s easy to understand (the linked list code is not commented).<\/p>\n<p>And here it comes!<\/p>\n<pre><code>public class StrandSort\n{\n    public static int[] SortWithGenerics(int[] Values)\n    {\n\n        List&lt;int&gt; Original = new List&lt;int&gt;();\n        List&lt;int&gt; Result = new List&lt;int&gt;();\n        List&lt;int&gt; Sublist = new List&lt;int&gt;();\n\n        Original.AddRange(Values);\n\n        \/\/While we still have numbers to sort\n        while (Original.Count &gt; 0)\n        {\n\n            \/\/Clear sublist and take first available number from original to the new sublist\n            Sublist.Clear();\n            Sublist.Add(Original[0]);\n            Original.RemoveAt(0);\n\n            \/\/Iterate through original numbers\n            for (int x = 0; x &lt; Original.Count; x++)\n            {\n                \/\/If the number is bigger than the last item in the sublist\n                if (Original[x] &gt; Sublist[Sublist.Count - 1])\n                {\n                    \/\/Add it to the sublist and remove it from original\n                    Sublist.Add(Original[x]);\n                    Original.RemoveAt(x);\n                    \/\/Roll back one position to compensate the removed item\n                    x--;\n\n                }\n\n            }\n\n            \/\/If this is the first sublist\n            if (Result.Count == 0)\n                Result.AddRange(Sublist); \/\/Add all the numbers to the result\n            else\n            {\n                \/\/Iterate through the sublist\n                for (int x = 0; x &lt; Sublist.Count; x++)\n                {\n\n                    bool inserted = false;\n\n                    \/\/Iterate through the current result\n                    for (int y = 0; y &lt; Result.Count; y++)\n                    {\n                        \/\/Is the sublist number lower than the current item from result?\n                        if (Sublist[x] &lt; Result[y])\n                        {\n                            \/\/Yes, insert it at the current Result position\n                            Result.Insert(y, Sublist[x]);\n                            inserted = true;\n                            break;\n\n                        }\n\n                    }\n\n                    \/\/Did we inserted the item because found it was lower than one of the result's number?\n                    if (!inserted)\n                        Result.Add(Sublist[x]);\/\/No, we add it to the end of the results\n\n                }\n\n            }\n\n        }\n\n        \/\/Return the results\n        return Result.ToArray();\n    }\n\n    public static int[] SortWithoutGenerics(int[] Values)\n    {\n\n        IntLinkedList Original = new IntLinkedList();\n        IntLinkedList Result = new IntLinkedList();\n        IntLinkedList Sublist = new IntLinkedList();\n\n        Original.AddRange(Values);\n\n        \/\/While we still have numbers to sort\n        while (Original.Count &gt; 0)\n        {\n\n            \/\/Clear sublist and take first available number from original to the new sublist\n            Sublist.Clear();\n            Sublist.Add(Original.FirstItem.Value);\n            Original.Remove(Original.FirstItem);\n\n            IntLinkedItem currentOriginalItem = Original.FirstItem;\n\n            \/\/Iterate through original numbers\n            while (currentOriginalItem != null)\n            {\n                \/\/If the number is bigger than the last item in the sublist\n                if (currentOriginalItem.Value &gt; Sublist.LastItem.Value)\n                {\n                    \/\/Add it to the sublist and remove it from original\n                    Sublist.Add(currentOriginalItem.Value);\n                    \/\/Store the next item\n                    IntLinkedItem nextItem = currentOriginalItem.NextItem;\n                    \/\/Remove current item from original\n                    Original.Remove(currentOriginalItem);\n                    \/\/Set next item as current item\n                    currentOriginalItem = nextItem;\n\n\n                }\n                else\n                    currentOriginalItem = currentOriginalItem.NextItem;\n\n            }\n\n            \/\/If this is the first sublist\n            if (Result.Count == 0)\n                Result.AddRange(Sublist); \/\/Add all the numbers to the result\n            else\n            {\n\n                IntLinkedItem currentSublistItem = Sublist.FirstItem;\n\n                \/\/Iterate through the sublist\n                while (currentSublistItem != null)\n                {\n\n                    bool inserted = false;\n\n                    IntLinkedItem currentResultItem = Result.FirstItem;\n\n                    \/\/Iterate through the current result\n                    while (currentResultItem != null)\n                    {\n                        \/\/Is the sublist number lower than the current item from result?\n                        if (currentSublistItem.Value &lt; currentResultItem.Value)\n                        {\n                            \/\/Yes, insert it at the current Result position\n                            Result.InsertBefore(currentResultItem, currentSublistItem.Value);\n                            inserted = true;\n                            break;\n\n                        }\n\n                        currentResultItem = currentResultItem.NextItem;\n\n                    }\n\n                    \/\/Did we inserted the item because found it was lower than one of the result's number?\n                    if (!inserted)\n                        Result.Add(currentSublistItem.Value);\/\/No, we add it to the end of the results\n\n                    currentSublistItem = currentSublistItem.NextItem;\n\n                }\n\n            }\n\n        }\n\n        \/\/Return the results\n        return Result.ToArray();\n    }\n\n    public class IntLinkedList\n    {\n\n        public int count = 0;\n        IntLinkedItem firstItem = null;\n        IntLinkedItem lastItem = null;\n\n        public IntLinkedItem FirstItem { get { return firstItem; } }\n        public IntLinkedItem LastItem { get { return lastItem; } }\n        public int Count { get { return count; } }\n\n        public void Add(int Value)\n        {\n\n            if (firstItem == null)\n                firstItem = lastItem = new IntLinkedItem { Value = Value };\n            else\n            { \n\n                IntLinkedItem item = new IntLinkedItem{  PreviousItem = lastItem, Value = Value };\n                lastItem.NextItem = item;\n                lastItem = item;\n\n            }\n\n            count++;\n\n        }\n\n        public void AddRange(int[] Values)\n        {\n\n            for (int buc = 0; buc &lt; Values.Length; buc++)\n                Add(Values[buc]);\n\n        }\n\n        public void AddRange(IntLinkedList Values)\n        {\n\n            IntLinkedItem item = Values.firstItem;\n\n            while (item != null)\n            {\n\n                Add(item.Value);\n                item = item.NextItem;\n\n            }\n\n        }\n\n        public void Remove(IntLinkedItem Item)\n        {\n            if (Item == firstItem)\n                firstItem = Item.NextItem;\n\n            if (Item == lastItem)\n                lastItem = Item.PreviousItem;\n\n            if(Item.PreviousItem != null)\n                Item.PreviousItem.NextItem = Item.NextItem;\n\n            if (Item.NextItem != null)\n                Item.NextItem.PreviousItem = Item.PreviousItem;\n\n            count--;\n\n        }\n\n        public void InsertBefore(IntLinkedItem Item, int Value)\n        {\n\n            IntLinkedItem newItem = new IntLinkedItem { PreviousItem = Item.PreviousItem, NextItem = Item, Value = Value };\n\n            if (Item.PreviousItem != null)\n                Item.PreviousItem.NextItem = newItem;\n\n            Item.PreviousItem = newItem;\n\n            if (Item == firstItem)\n                firstItem = newItem;\n\n            count++;\n        }\n\n        public void Clear()\n        {\n\n            count = 0;\n            firstItem = lastItem = null;\n\n        }\n\n        public int[] ToArray()\n        {\n\n            int[] results = new int[Count];\n            int pos = 0;\n\n            IntLinkedItem item = firstItem;\n\n            while (item != null)\n            {\n                results[pos++] = item.Value;\n                item = item.NextItem;\n            }\n\n            return results;\n\n        }\n    }\n\n    public class IntLinkedItem\n    { \n\n        public int Value;\n        internal IntLinkedItem PreviousItem;\n        internal IntLinkedItem NextItem;\n\n    }\n}\n<\/code><\/pre>\n<p><strong>EDIT<\/strong>: It&#8217;s really not a linked list but a double linked list \ud83d\ude09<\/p>\n<p><strong>EDIT<\/strong>: Corrected a missing &#8220;else&#8221; in non-generic implementation<\/p>\n<p><strong>EDIT<\/strong>: I was <em>really<\/em> bored and created a refactored and corrected version of the user&#8217;s code with commented changes so he can learn from it \ud83d\ude09<\/p>\n<p><strong>Note to user<\/strong>: I recommend you to use more meaningful names for variables, it is a lot easier to understand the code when you read it.<\/p>\n<pre><code>    static public int[] SortCorrectedUserCode(int[] Source)\n    {\n        int[] Sublist,\n            Results;\n        int ItemsLeft,\n            SublistPos,\n            ResultPos;\/\/new variable to store current pos in results\n        \/\/n; n was useless\n\n        Sublist = new int[Source.Length];\n        Results = new int[Source.Length];\n        \/\/Avoid resets just using an integer to track array lengths\n        \/\/Reset(ref Sublist);\n        \/\/Reset(ref Results);\n        ItemsLeft = Source.Length;\n\n        ResultPos = 0;\n\n        while (ItemsLeft != 0)\n        {\n            \/\/n = int.MinValue;\n            SublistPos = 0;\n\n            for (int currentSourcePos = 0; currentSourcePos &lt; Source.Length; currentSourcePos++)\n            {\n                if (Source[currentSourcePos] != int.MaxValue)\n                {\n                    \/\/Added special treatment for first item in sublist (copy it yes or yes ;D)\n                    if (SublistPos == 0 || Source[currentSourcePos] &gt; Sublist[SublistPos])\n                    {\n\n                        Sublist[SublistPos] = Source[currentSourcePos];\n                        \/\/n = Source[currentSourcePos]; useless\n                        Source[currentSourcePos] = int.MaxValue;\n                        ItemsLeft--;\n                        SublistPos++;\n                    }\n                }\n            }\n\n            \/\/int p3p, zs;\n\n            \/\/pn is never true...\n            \/\/bool pn = false;\n\n            \/\/Sublist was being iterated for all it's length, not only for the current items\n            \/\/for (int currentSublistPos = 0; currentSublistPos &lt; Sublist.Length; currentSublistPos++)\n\n            for (int currentSublistPos = 0; currentSublistPos &lt; SublistPos; currentSublistPos++)\n            {\n                \/\/p3p = int.MinValue;\n\n                bool inserted = false;\n\n                \/\/Results was being iterated for all it's length, not only for current items\n                \/\/for (int currentResultPos = 0; currentResultPos &lt; Results.Length; currentResultPos++)\n\n                for (int currentResultPos = 0; currentResultPos &lt; ResultPos; currentResultPos++)\n                {\n\n                    \/\/This part was never used...\n                    \/\/if (pn)\n                    \/\/{\n                    \/\/    zs = Results[currentResultPos];\n                    \/\/    Results[currentResultPos] = p3p;\n                    \/\/    p3p = zs;\n                    \/\/}\n                    \/\/else\n                    \/\/{\n\n                    \/\/This IF was wrong, when the code entered this piece of code it started\n                    \/\/for subsequent iterations in the current loop to copy data from sublist to list, which is not correct ... I think, not sure \n                    \/\/because it's really confusing\n                    \/\/if (Sublist[currentSublistPos] &gt;= p3p &amp;&amp; Sublist[currentSublistPos] &lt;= Results[currentResultPos])\n                    \/\/{\n                    \/\/p3p = Results[currentResultPos];\n                    \/\/Results[currentResultPos] = Sublist[currentSublistPos];\n                    \/\/}\n                    \/\/}\n\n                    \/\/New code, if the item at sublist is lower than the one at results then insert item in current position\n                    if (Sublist[currentSublistPos] &lt; Results[currentResultPos])\n                    {\n\n                        InsertInArray(currentResultPos, Sublist[currentSublistPos], Results);\n                        inserted = true;\n                        break;\n\n                    }\n                }\n                \/\/Did we inserted the item?\n                if (!inserted)\n                    Results[ResultPos] = Sublist[currentSublistPos]; \/\/If no then just add it to the end of the results\n\n                ResultPos++;\n            }\n\n            \/\/Reset(ref Sublist);\n        }\n\n        return Results;\n    }\n\n    \/\/Helper function to insert a value in an array and displace values to the right\n    static void InsertInArray(int Index, int Value, int[] Target)\n    {\n        \/\/Create temp array of right items\n        int[] tempArray = new int[(Target.Length - Index) - 1];\n\n        \/\/Copy items to temp array\n        Array.Copy(Target, Index, tempArray, 0, tempArray.Length);\n\n        \/\/Set value at index\n        Target[Index] = Value;\n\n        \/\/Copy values from temp array to correct position\n        Array.Copy(tempArray, 0, Target, Index + 1, tempArray.Length);\n\n    }\n<\/code><\/pre>\n<p>Also did some benchmarking on the functions (because the user was concerned about speed) and those are the results running on my machoine in debug mode (for 5000 items, did not have patience to test longer arrays because old code was very slow):<\/p>\n<ul>\n<li>Generics: 36ms <\/li>\n<li>Non-generics: 21ms <\/li>\n<li>User original code 23248ms<\/li>\n<li>Corrected code: 34ms<\/li>\n<\/ul>\n<\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">0<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved How to sort (using strand sort algorithm) an array of integers? C# [closed] <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Ok, I got bored and wanted to help (also, a question with that quantity of comments cannot be left without an answer :D), so took the Wikipedia PHP implementation and converted it to C#, but after a bit the user added he cannot use generics&#8230; So, I&#8217;m posting a full implementation, one with generics &#8230; <a title=\"[Solved] How to sort (using strand sort algorithm) an array of integers? C# [closed]\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/\" aria-label=\"More on [Solved] How to sort (using strand sort algorithm) an array of integers? C# [closed]\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[324,561],"class_list":["post-15614","post","type-post","status-publish","format-standard","hentry","category-solved","tag-c","tag-sorting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] How to sort (using strand sort algorithm) an array of integers? C# [closed] - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] How to sort (using strand sort algorithm) an array of integers? C# [closed] - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] Ok, I got bored and wanted to help (also, a question with that quantity of comments cannot be left without an answer :D), so took the Wikipedia PHP implementation and converted it to C#, but after a bit the user added he cannot use generics&#8230; So, I&#8217;m posting a full implementation, one with generics ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-12T02:29:50+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] How to sort (using strand sort algorithm) an array of integers? C# [closed]\",\"datePublished\":\"2022-10-12T02:29:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/\"},\"wordCount\":264,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"c++\",\"sorting\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/\",\"name\":\"[Solved] How to sort (using strand sort algorithm) an array of integers? C# [closed] - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2022-10-12T02:29:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] How to sort (using strand sort algorithm) an array of integers? C# [closed]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] How to sort (using strand sort algorithm) an array of integers? C# [closed] - JassWeb","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:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] How to sort (using strand sort algorithm) an array of integers? C# [closed] - JassWeb","og_description":"[ad_1] Ok, I got bored and wanted to help (also, a question with that quantity of comments cannot be left without an answer :D), so took the Wikipedia PHP implementation and converted it to C#, but after a bit the user added he cannot use generics&#8230; So, I&#8217;m posting a full implementation, one with generics ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/","og_site_name":"JassWeb","article_published_time":"2022-10-12T02:29:50+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] How to sort (using strand sort algorithm) an array of integers? C# [closed]","datePublished":"2022-10-12T02:29:50+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/"},"wordCount":264,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["c++","sorting"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/","url":"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/","name":"[Solved] How to sort (using strand sort algorithm) an array of integers? C# [closed] - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-10-12T02:29:50+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-sort-using-strand-sort-algorithm-an-array-of-integers-c-closed\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] How to sort (using strand sort algorithm) an array of integers? C# [closed]"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/15614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=15614"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/15614\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=15614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=15614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=15614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}