Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

bubble sort recursive c#

public int[] Sort(int[] sortArray)
    {
        for (int i = 0; i < sortArray.Length - 1; i++)
        {
            for (int j = sortArray.Length - 1; j > i; j--)
            {
                if (sortArray[j] < sortArray[j - 1])
                {
                    int x = sortArray[j];
                    sortArray[j] = sortArray[j - 1];
                    sortArray[j - 1] = x;

                }
            }
        }
        return sortArray;
    } 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #bubble #sort #recursive
ADD COMMENT
Topic
Name
1+8 =