<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jeyhun Rahimov on Medium]]></title>
        <description><![CDATA[Stories by Jeyhun Rahimov on Medium]]></description>
        <link>https://medium.com/@jhoonbey?source=rss-f8792b28f95------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*DMdytcYTWCqDWID0x-wcaQ.jpeg</url>
            <title>Stories by Jeyhun Rahimov on Medium</title>
            <link>https://medium.com/@jhoonbey?source=rss-f8792b28f95------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 16:45:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jhoonbey/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Sorting algorithms (C#, Java)]]></title>
            <link>https://medium.com/engineering-hub/https-medium-com-engineering-hub-sorting-algorithms-in-csharp-and-java-4615f6f87696?source=rss-f8792b28f95------2</link>
            <guid isPermaLink="false">https://medium.com/p/4615f6f87696</guid>
            <category><![CDATA[sort]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[sorting-algorithms]]></category>
            <dc:creator><![CDATA[Jeyhun Rahimov]]></dc:creator>
            <pubDate>Tue, 12 Nov 2019 13:17:39 GMT</pubDate>
            <atom:updated>2019-11-12T13:17:39.911Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W-UuMZARf1iwe4gmo4qUUA.png" /></figure><p>Sorting algorithms are used to rearrange elements of arrays (lists) in particular order. Sorting mostly can be in numerical (0–9) and alphabetical ( A-Z) order.</p><p><strong>Why need?</strong></p><p>Sorting algorithms reduce the complexity of problems and used on Database searching etc.</p><p>Some of the common sorting algorithms are</p><ul><li>Selection Sort</li><li>Insertion Sort</li><li>Bubble Sort</li><li>Merge Sort</li><li>Quick Sort</li><li>Heap Sort</li><li>Counting Sort</li><li>Radix Sort</li><li>Bucket Sort</li></ul><p><strong>Selection sort.</strong></p><p>This is one of the simplest sorting algorithms.</p><ol><li>Find the smallest element in an array, replace it with the first element.</li><li>Find the smallest element in the unsorted part of an array, replace it with the second element.</li><li>Repeat this process until the end and array will be sorted at the end.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*hAP9BFr5wIkQtb0f5tBllA.png" /></figure><p><em>Code samples in C# and Java:</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b987565e57fe4d29aa4bdb2d177ec488/href">https://medium.com/media/b987565e57fe4d29aa4bdb2d177ec488/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e35321b5cbc7f9ca517e2a5cdbba341/href">https://medium.com/media/0e35321b5cbc7f9ca517e2a5cdbba341/href</a></iframe><p>Time Complexity is<strong> </strong>O(n2) as there are two nested loops. The selection sort is <strong>not stable</strong>.</p><p><em>A sorting algorithm is said to be </em><strong><em>stable </em></strong><em>if two objects with equal keys appear in the same order in sorted output as they appear in the input array to be sorted.</em></p><p>For example, [CC, AA, BZ, DD, BM] array after “stable” sorting algorithms will be [AA, BZ, BM, CC, DD]. As you see BZ and BM stay in their relative positions. But in <strong><em>unstable </em></strong>sort algorithm, they would be replaced:</p><p>[AA, BM, BZ, CC, DD]</p><p><strong>Insertion sort.</strong></p><p>Insertion sort is basically for a small number of elements. In this algorithm, you compare every element with the previous element. If the previous element is greater than your current element, you move that (previous) element to the next position. If not, you continue to find a great number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*wbMnronniIQUzdMgo7Gmkw.png" /></figure><p><em>Code samples in C# and Java:</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/58350f3092b3076499cf9eb0aa5f6bac/href">https://medium.com/media/58350f3092b3076499cf9eb0aa5f6bac/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7255a17dcfa579805e0aa101293a9fc2/href">https://medium.com/media/7255a17dcfa579805e0aa101293a9fc2/href</a></iframe><p>Time Complexity is<strong> </strong>O(n2) as inserting elements from an unsorted array into a sorted subsection of the array. The insertion sort is <strong>stable</strong>.</p><p><strong>Bubble sort.</strong></p><p>Bubble sort is a comparison-based algorithm that compares every pair of elements in an array and swaps them if they are in the wrong order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*Uerofp127-wrRSBwR81T9Q.png" /></figure><p><em>Code samples in C# and Java:</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/356c0b23d90769456cf6e41a68fca884/href">https://medium.com/media/356c0b23d90769456cf6e41a68fca884/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/18fd702518f117490c1f9b6fe60923b1/href">https://medium.com/media/18fd702518f117490c1f9b6fe60923b1/href</a></iframe><p>Time Complexity is<strong> </strong>O(n²) as repeatedly passes through the unsorted part of the list. The bubble sort is <strong>stable</strong>.</p><p>Software developers should have knowledge about sorting algorithms. Sometimes, this helps them to solve some huge solutions with lists - by splitting it into small parts and applying relevant sort algorithms to lists. As well, this can help us to pass a coding interview in big companies.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4615f6f87696" width="1" height="1" alt=""><hr><p><a href="https://medium.com/engineering-hub/https-medium-com-engineering-hub-sorting-algorithms-in-csharp-and-java-4615f6f87696">Sorting algorithms (C#, Java)</a> was originally published in <a href="https://medium.com/engineering-hub">Engineering Hub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>