22 lines
678 B
Python
Executable File
22 lines
678 B
Python
Executable File
from os import replace
|
|
import sort_methods
|
|
from random import randint
|
|
|
|
array = [randint(-100, 100) for _ in range(30)]
|
|
with open("input.txt", "w") as inputFile:
|
|
for element in array:
|
|
inputFile.write(f"{element}\n")
|
|
listOfNumber = []
|
|
with open("input.txt", "r") as inputFile:
|
|
for string in inputFile:
|
|
listOfNumber.append(int(string.replace("\n", "")))
|
|
print(listOfNumber)
|
|
listOfNumber = sort_methods.bubble_sort(listOfNumber)
|
|
|
|
with open("output.txt", "w") as outputFile:
|
|
for element in listOfNumber:
|
|
outputFile.write(f"{element}\n")
|
|
|
|
print("Пузырьковая сортировка")
|
|
print("сложность сортировки O(n^2)")
|