<commit_before>﻿using System;

namespace InsertionSort
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] unsortedArray = new int[] { 14, 18, 4, 3, 9, 18, 47, 32, 10 };
            Console.WriteLine($"Our unsorted array: {PrintIntArray(unsortedArray)}.");
            Console.WriteLine($"Now we sort it and it becomes: {PrintIntArray(InsertionSort(unsortedArray))}.");
            Console.Read();
        }

        static int[] InsertionSort(int[] sortArray)
        {
            for (int i = 1; i < sortArray.Length; i++)
            {
                int j = i;
                while (j > 0)
                {
                    if (sortArray[j - 1] > sortArray[j])
                    {
                        int temp = sortArray[j - 1];
                        sortArray[j - 1] = sortArray[j];
                        sortArray[j] = temp;
                        j--;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            return sortArray;
        }

        static string PrintIntArray(int[] array)
        {
            string phrase = "";
            foreach (var item in array)
            {
                phrase += " " + item;
            }
            return phrase;
        }
    }
}<commit_msg>added comments for clarification<commit_after>﻿using System;

namespace InsertionSort
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] unsortedArray = new int[] { 14, 18, 4, 3, 9, 18, 47, 32, 10 };
            Console.WriteLine($"Our unsorted array: {PrintIntArray(unsortedArray)}.");
            Console.WriteLine($"Now we sort it and it becomes: {PrintIntArray(InsertionSort(unsortedArray))}.");
            Console.Read();
        }

        static int[] InsertionSort(int[] sortArray)
        {
            // For each item in the array, except for the item in index 0, as it is assumed to be in its proper spot at the start
            for (int i = 1; i < sortArray.Length; i++)
            {
                int j = i;
                // While the current value being sorted is not in index 0 of the array
                while (j > 0)
                {
                    // If the value at index j is less than the value at index j - 1, replace the value at j - 1 with j, and decrement j. Else break the while loop.
                    if (sortArray[j - 1] > sortArray[j])
                    {
                        int temp = sortArray[j - 1];
                        sortArray[j - 1] = sortArray[j];
                        sortArray[j] = temp;
                        j--;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            // Return the sorted array
            return sortArray;
        }

        static string PrintIntArray(int[] array)
        {
            string phrase = "";
            foreach (var item in array)
            {
                phrase += " " + item;
            }
            return phrase;
        }
    }
}
{'fraction_non_alphanumeric': 0.095088161209068, 'fraction_numerical': 0.013853904282115869, 'mean_word_length': 1.0430868167202572, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '395275', 'n_tokens_mistral': 866, 'n_tokens_neox': 772, 'n_words': 250}