<jupyter_start><jupyter_text><jupyter_code># Function bublesort to implement bubble sort

def bubblesort (arr) :
  n = len(arr)

  # Traverse through array elements 
  for i in range(n - 1 ) :
    swapped = False # bool to hold true if a swapping is done
    for j in range (n - 1 - i) :
      if arr[j] > arr[j+1] :
        swapped = True
        arr[j], arr[j+1] = arr[j+1], arr[j] # Swap 
    
    # The array is already sorted
    if not swapped :
      break

dataset = [ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1  ]
bubblesort(dataset)
print(dataset)<jupyter_output>[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
{'fraction_non_alphanumeric': 0.1319796954314721, 'fraction_numerical': 0.04568527918781726, 'mean_word_length': 2.587878787878788, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, '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}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '517201', 'license': 'Apache-2.0', 'n_tokens_mistral': 262, 'n_tokens_neox': 232, 'n_words': 80, 'path': '1st-sem-pg/python/bubblesort.ipynb', 'repo_name': 'Panchajanya1999/Programmings', 'size': '591'}