<commit_before>//Bubble Sort

/*RULES
  Takes one parameter
    An array
  Sort it using bubble sort
  Return sorted array
*/

/*PSEUDOCODE
  1) Get the array.length, because you'll need this number later
  2) For loop
    2a) For each number, check the number directly to the right of it.
    2b) If num < numRight, move to the next num
    2c) Else if num > numRight, swap positions of each other.
    2d) Reach the end, then repeat the process.  Do it but this time, array.length - 1 (minus 1 more each loop) times
  3) Return bubble sorted array
*/
<commit_msg>Complete algorightm challenge with nested loop<commit_after>//Bubble Sort

/*RULES
  Takes one parameter
    An array
  Sort it using bubble sort
  Return sorted array
*/

/*PSEUDOCODE
  1) Get the array.length, because you'll need this number later
  2) For loop
    2a) For each number, check the number directly to the right of it.
    2b) If num < numRight, move to the next num
    2c) Else if num > numRight, swap positions of each other.
    2d) Reach the end, then repeat the process.  Do it but this time, array.length - 1 (minus 1 more each loop) times
  3) Return bubble sorted array
*/

function bubbleSort(arr){
  var length = arr.length;

  for (var i = length; i > 0; i--){

    for (var j = 0; j < i; j++){
      var tempHolder = 0;
      if (arr[j] > arr[j + 1]){
        tempholder = arr[j];
        arr[j] = arr[j + 1];
        arr[j + 1] = tempholder;
      }
    }

  }
return arr
}
{'fraction_non_alphanumeric': 0.08787465940054497, 'fraction_numerical': 0.01634877384196185, 'mean_word_length': 2.663341645885287, 'pattern_counts': {'":': 0, '<': 6, '<?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': '5780975', 'n_tokens_mistral': 491, 'n_tokens_neox': 475, 'n_words': 217}