diff --git a/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/TA_Lab2_Sperkach_Anna_IS-01.pyproj b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/TA_Lab2_Sperkach_Anna_IS-01.pyproj new file mode 100644 index 0000000..0cc0c76 --- /dev/null +++ b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/TA_Lab2_Sperkach_Anna_IS-01.pyproj @@ -0,0 +1,38 @@ + + + Debug + 2.0 + e02209fb-63d5-47fd-83bd-b36e5c9349d5 + . + TA_Lab2_Sperkach_Anna_IS_01.py + + + . + . + TA_Lab2_Sperkach_Anna_IS-01 + TA_Lab2_Sperkach_Anna_IS-01 + + + true + false + + + true + false + + + + Code + + + + + + + + + + + \ No newline at end of file diff --git a/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/TA_Lab2_Sperkach_Anna_IS-01.pyproj.user b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/TA_Lab2_Sperkach_Anna_IS-01.pyproj.user new file mode 100644 index 0000000..566c009 --- /dev/null +++ b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/TA_Lab2_Sperkach_Anna_IS-01.pyproj.user @@ -0,0 +1,6 @@ + + + + ShowAllFiles + + \ No newline at end of file diff --git a/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/TA_Lab2_Sperkach_Anna_IS-01.sln b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/TA_Lab2_Sperkach_Anna_IS-01.sln new file mode 100644 index 0000000..1631d85 --- /dev/null +++ b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/TA_Lab2_Sperkach_Anna_IS-01.sln @@ -0,0 +1,27 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30907.101 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "TA_Lab2_Sperkach_Anna_IS-01", "TA_Lab2_Sperkach_Anna_IS-01.pyproj", "{E02209FB-63D5-47FD-83BD-B36E5C9349D5}" +EndProject +Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "minimum", "..\minimum\minimum.pyproj", "{D1A42009-002B-45BD-9885-4E89B34F8DBB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E02209FB-63D5-47FD-83BD-B36E5C9349D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E02209FB-63D5-47FD-83BD-B36E5C9349D5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1A42009-002B-45BD-9885-4E89B34F8DBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1A42009-002B-45BD-9885-4E89B34F8DBB}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {690E8806-05B2-43C1-8524-479AD6307BC1} + EndGlobalSection +EndGlobal diff --git a/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/TA_Lab2_Sperkach_Anna_IS_01.py b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/TA_Lab2_Sperkach_Anna_IS_01.py new file mode 100644 index 0000000..421aabe --- /dev/null +++ b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/TA_Lab2_Sperkach_Anna_IS_01.py @@ -0,0 +1,102 @@ +import numpy as np +import random +from call import plot_data + +sizes = [10, 100, 1000] +#sizes = [10] +#sizes = [100] +#sizes = [1000] + +types = ["random", "best", "worst"] +data_plot = {'random': {'bubble':{}, 'insertion':{}, 'bubble_impr':{}}, + 'best': {'bubble':{}, 'insertion':{}, 'bubble_impr':{}}, + 'worst': {'bubble':{}, 'insertion':{}, 'bubble_impr':{}}} + + +def generate_data(n, gen_typ="random"): + + if gen_type=="best": + a = [i+1 for i in range(n)] + return a + elif gen_type=="worst": + a = [i+1 for i in reversed(range(n))] + return a + else: + a = [i+1 for i in range(n)] + random.shuffle(a) + return a + + +def bubble_sort(arr): + #print(arr) + counter=0 + for i in range(len(arr)-1): + for j in range(0, len(arr)-1): + counter+=1 + if arr[j] > arr[j+1] : + arr[j], arr[j+1] = arr[j+1], arr[j] + #print (arr) + return counter + +def bubble_impr_sort(arr): + counter =0 + #print (arr) + swapped = True + endOfList = len(arr)-1 + while swapped: + swapped = False + for i in range(endOfList): + counter += 1 + if arr[i] >= arr[i+1]: + arr[i],arr[i+1] = arr[i+1],arr[i] + swapped = True + endOfList-=1 + #print (arr) + return counter + +def insertion_sort(arr): + counter = 0 + for i in range(1,len(arr)): + key = arr[i] + j = i-1 + while j>=0 and arr[j] > key: + counter +=1 + arr[j+1] = arr[j] + j -= 1 + arr[j+1] = key + counter += 1 + print (arr) + + min(arr) + print ("\tМинимальный элемент в insertion sort:", min(arr)) + return counter + + + + +for n in sizes: + print ("\nDATA SIZE: ", n) + + for gen_type in types: + print( "\n\tDATA TYPE:", gen_type) + data = generate_data(n, gen_type) + + data_bubble = np.copy(data) + bubble_op_count = bubble_sort(data_bubble) + print ("\tBubble sort Кол-во сравнений:", int(bubble_op_count)) + data_plot[gen_type]['bubble'][n] = bubble_op_count + + data_bubble_impr = np.copy(data) + bubble_impr_op_count = bubble_impr_sort(data_bubble_impr) + print ("\tImproved bubble sort Кол-во сравнений:", int(bubble_impr_op_count)) + data_plot[gen_type]['bubble_impr'][n] = bubble_impr_op_count + + data_insertion = np.copy(data) + insertion_op_count = insertion_sort(data_insertion) + print ("\tInsertion sort Кол-во сравнений:", int(insertion_op_count)) + data_plot[gen_type]['insertion'][n] = insertion_op_count + + +#Побудова графіків швидкодії алгоритмів +plot_data(data_plot, logarithmic=True, oneplot=True) + diff --git a/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/__pycache__/call.cpython-37.pyc b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/__pycache__/call.cpython-37.pyc new file mode 100644 index 0000000..6425396 Binary files /dev/null and b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/__pycache__/call.cpython-37.pyc differ diff --git a/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/__pycache__/graphic.cpython-37.pyc b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/__pycache__/graphic.cpython-37.pyc new file mode 100644 index 0000000..d2feb14 Binary files /dev/null and b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/__pycache__/graphic.cpython-37.pyc differ diff --git a/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/__pycache__/plot_data.cpython-37.pyc b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/__pycache__/plot_data.cpython-37.pyc new file mode 100644 index 0000000..37d1489 Binary files /dev/null and b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/__pycache__/plot_data.cpython-37.pyc differ diff --git a/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/call.py b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/call.py new file mode 100644 index 0000000..992cc65 --- /dev/null +++ b/2Lab_TA-master/TA_Lab2_Sperkach_Anna_IS-01/call.py @@ -0,0 +1,68 @@ +import collections +import matplotlib.pyplot as plt +import numpy as np +from pylab import figure, show +from math import log + +def plot_data(data, logarithmic=False, oneplot=False): + #print(data) + fig = figure(1) + num = len(data) + colors = ['y','b','r'] + markers = ['o','s','x'] + lines = ['-','--',':'] + + if oneplot==True: + ax = fig.add_subplot(111) + ax.grid(True) + i = -1 + line_titles = [] + x_max = y_max = 0 + for label, value in data.items(): + i += 1 + j = -1 + for sort_type, points in value.items(): + j += 1 + od_points = collections.OrderedDict(sorted(points.items())) + if logarithmic: + xs = [(x>0 and log(x,10) or 0) for x in od_points.keys()] + ys = [(y>0 and log(y,10) or 0) for y in od_points.values()] + else: + xs = od_points.keys() + ys = od_points.values() + xs.insert(0,0) + x_max = max(x_max, max(xs)) + ys.insert(0,0) + y_max = max(y_max, max(ys)) + ax.plot(xs, ys, colors[j%num]+markers[j%num]+lines[i%num], label=sort_type ) + line_titles.append(sort_type+' '+label) + ax.set_xlim( (0, x_max*1.1) ) + ax.set_ylim( (0, y_max*1.1) ) + ax.legend(line_titles, loc=4) + else: + i = 0 + for label, value in data.items(): + i += 1 + ax = fig.add_subplot(num,1,i) + ax.grid(True) + ax.set_title(label) + j = -1 + x_max = y_max = 0 + for sort_type, points in value.items(): + j += 1 + od_points = collections.OrderedDict(sorted(points.items())) + if logarithmic: + xs = [log(x,10) for x in od_points.keys()] + ys = [log(y,10) for y in od_points.values()] + else: + xs = od_points.keys() + ys = od_points.values() + xs.insert(0,0) + x_max = max(x_max, max(xs)) + ys.insert(0,0) + y_max = max(y_max, max(ys)) + ax.plot(xs, ys, colors[j%num]+markers[j%num]+'-', label=sort_type ) + ax.set_xlim( (0, x_max*1.1) ) + ax.set_ylim( (0, y_max*1.1) ) + ax.legend(loc=4) + show() diff --git a/3Lab_TA_2sem-master/TA_3Lab.py b/3Lab_TA_2sem-master/TA_3Lab.py new file mode 100644 index 0000000..d164d26 --- /dev/null +++ b/3Lab_TA_2sem-master/TA_3Lab.py @@ -0,0 +1,57 @@ +import numpy as np +from merge_sort import SortAndCountInversitions +from merge_sort import MergeAndCountSplitInversitions +from merge_sort import AllUsersSort +from merge_sort import ResultSort + + +def InPut(): #include the input + f=open("input.txt") + lst = [] + for row in f: + strs = row.split(' ') + for s in strs: + if s != ' ': + lst = lst +[int(s)] + AllUsers = int(lst[0]); + AllFilms = int(lst[1]); + array = np.zeros((AllUsers, AllFilms), dtype=int) + t = 2 + for i in range (AllUsers): + num = int(lst[t]); + t+=1 + for j in range(AllFilms): + array[i][j] = lst[t] + t+=1 + f.close() + return (AllUsers, AllFilms, array) + +def OutPut(result, User, AllUsers): + f = open("output.txt", 'wt') + User +=1 + s = str(User) + '\n' + f.write(s) + for i in range(1, AllUsers): + s1= str(result[i][0]) + s2= str(result[i][1]) + f.write(s1 +' ' + s2 +'\n') + + + +AllUsers, AllFilms, array = InPut() +User = int(input("Choose the User to be compared:")) +User -=1; +array = AllUsersSort(array, User, AllUsers, AllFilms); +result = np.zeros((AllUsers, 2), dtype=int); +t=0; +for i in range(AllUsers): + if i != User: + t+=1 + result[t][0]=i+1 + massive = array[i] + A, result[t][1] = SortAndCountInversitions(list(massive)) +result = ResultSort(result, AllUsers) +OutPut(result, User, AllUsers) + + + diff --git a/3Lab_TA_2sem-master/input.txt b/3Lab_TA_2sem-master/input.txt new file mode 100644 index 0000000..2307424 --- /dev/null +++ b/3Lab_TA_2sem-master/input.txt @@ -0,0 +1,23 @@ +22 7 +1 1 2 3 4 5 6 7 +2 1 2 3 4 5 7 6 +3 1 2 3 4 6 7 5 +4 1 2 3 4 7 6 5 +5 1 2 3 5 7 6 4 +6 1 2 3 6 7 5 4 +7 1 2 3 7 6 5 4 +8 1 2 4 7 6 5 3 +9 1 2 5 7 6 4 3 +10 1 2 6 7 5 4 3 +11 1 2 7 6 5 4 3 +12 1 3 7 6 5 4 2 +13 1 4 7 6 5 3 2 +14 1 5 7 6 4 3 2 +15 1 6 7 5 4 3 2 +16 1 7 6 5 4 3 2 +17 2 7 6 5 4 3 1 +18 3 7 6 5 4 2 1 +19 4 7 6 5 3 2 1 +20 5 7 6 4 3 2 1 +21 6 7 5 4 3 2 1 +22 7 6 5 4 3 2 1 \ No newline at end of file diff --git a/3Lab_TA_2sem-master/merge_sort.py b/3Lab_TA_2sem-master/merge_sort.py new file mode 100644 index 0000000..d2b37cb --- /dev/null +++ b/3Lab_TA_2sem-master/merge_sort.py @@ -0,0 +1,50 @@ +import numpy as np + +def SortAndCountInversitions(A): #inversion calculation procedure + AllUsers =len(A) + if AllUsers == 1: + return (A, 0) + else: + Left= A[:int(len(A)/2)] + Right= A[int(len(A)/2):] + Left, x = SortAndCountInversitions(Left) + Right, y = SortAndCountInversitions(Right) + A, z = MergeAndCountSplitInversitions(A, Left, Right) + return (A, x + y + z) + + +def MergeAndCountSplitInversitions(A, Left, Right): #using the method of merge sort and count the split inversitions + counter=0 #split inversion counter + n1= len(Left) + n2 = len(Right) + i=0 + j=0 + lst=[] + while i< n1 and j< n2: + if Left[i] <= Right[j]: + lst.append(Left[i]) #then go to the end of the list + i += 1 + else: + lst.append(Right[j]) + j += 1 + counter += (n1 -i) + lst= lst + Left[i:] + lst= lst + Right[j:] + return lst, counter; + +def ResultSort(result, AllUsers): #sort the massive with result + for i in range(AllUsers-1): + for j in range(0, AllUsers-1): + if result[j][1] > result[j+1][1] : + result[j][1], result[j+1][1] = result[j+1][1], result[j][1] + result[j][0], result[j+1][0] = result[j+1][0], result[j][0] + return result + + +def AllUsersSort(array, User, AllUsers, AllFilms): #sort the massive with AllUsers + for i in range(AllFilms-1): + for j in range(0, AllFilms-1): + if array[User][j] > array[User][j+1] : + for t in range(AllUsers): + array[t][j], array[t][j+1] = array[t][j+1], array[t][j] + return array diff --git a/3Lab_TA_2sem-master/output.txt b/3Lab_TA_2sem-master/output.txt new file mode 100644 index 0000000..f84fac0 --- /dev/null +++ b/3Lab_TA_2sem-master/output.txt @@ -0,0 +1,22 @@ +1 +2 1 +3 2 +4 3 +5 4 +6 5 +7 6 +8 7 +9 8 +10 9 +11 10 +12 11 +13 12 +14 13 +15 14 +16 15 +17 16 +18 17 +19 18 +20 19 +21 20 +22 21 diff --git a/Lab5TARadixSort-master/_5LabTA.py b/Lab5TARadixSort-master/_5LabTA.py new file mode 100644 index 0000000..d4e3681 --- /dev/null +++ b/Lab5TARadixSort-master/_5LabTA.py @@ -0,0 +1,42 @@ +import time +import random + + +def RadixSort(arr, d): #the function of Radix Sorting + place = 1 #first digit + for i in range(0, d): + CountingSort(arr, place) #call the algorithm of counting sorting + place *= 10 + +def CountingSort(arr, place): #the function of Counting Sorting + output = [0] * len(arr) + count = [0] * 10 + for i in range(0, len(arr)): + index = int((arr[i] / place)%10) + count[index] += 1 + for i in range(1, 10): + count[i] += count[i - 1] + i = len(arr)-1 + while i >= 0: + index = int((arr[i] / place)%10) + output[count[index] - 1] = arr[i] + count[index] -= 1 + i -= 1 + for i in range(0, len(arr)): + arr[i] = output[i] + + #our main +n = [10, 100] #choose the size of the array +d = int(input("Number of digits:")) #choose the digit number + +for i in n: + #arr = [55, 75, 12, 23, 45, 23, 78, 34, 35, 11] + arr = [random.randint(10**(d-1),10**d-1 ) for x in range(i)] #our array that are filled by the random numbers + start = time.perf_counter() + RadixSort(arr, d) + end = time.perf_counter() + ResultTime = end - start + print (arr) + print("Size:", i) + print ("Time:", end,"-", start,"=",ResultTime) #Elapsed time during the whole program in seconds + print ("RadixSort time:", ResultTime, "\n") \ No newline at end of file diff --git a/Lab6_TA_HeapSort-master/Ta6LabAllTog.py b/Lab6_TA_HeapSort-master/Ta6LabAllTog.py new file mode 100644 index 0000000..493fcea --- /dev/null +++ b/Lab6_TA_HeapSort-master/Ta6LabAllTog.py @@ -0,0 +1,140 @@ +from itertools import islice + +class MaxHeap: #незростаючa пірамідa + def max(A): #повернення максимального значення з незростаючої піраміди + maxim = 0 + for x in range(A.size()): + if(A.heap[x] > maxim): + maxim = A.heap[x] + return maxim + + def DelAndReturnMaxEl(A): #видалення та повернення максимального значення з незростаючої піраміди + if(len(A.heap) != 0): + maxelement = max(A.heap) + IndexMaxEl = A.heap.index(maxelement) + A.heap.pop(IndexMaxEl) + A.max_heapify(maxelement) + return maxelement + + def IncreaseValue(A, ind, value): #збільшення значення елементу піраміди за заданим індексом + if(ind <= A.heap.count()): + if(A.heap[ind] < value): + A.heap[ind] = value + A.max_heapify(A.heap, ind) + + def Insert(A, value): + A.heap.append(value) + A.max_heapify(len(A.heap)-1) + + def max_heapify(A, ind): #відновлення властивості незростаючої піраміди для заданого індексу + left = 2*ind + right = 2*ind+1 + if left < A.size() and A.heap[left] > A.heap[ind]: + largest = right + else: + largest = ind + + if right < A.size() and A.heap[right] > A.heap[largest]: + largest = right + + if largest != ind: + A.heap[ind], A.heap[largest] = A.heap[largest], A.heap[ind] + A.max_heapify(A.heap, largest) + + def __init__(A): + A.heap = [] + + def size(A): + return len(A.heap) + +class MinHeap: + def min(A): + minim = A.heap[0] + for x in range(A.size()): + if(A.heap[x] < minim): + minim = A.heap[x] + return minim + + def DelAndReturnMinEl(A): + if len(A.heap) != 0: + minelement = min(A.heap) + IndexMinEl = A.heap.index(minelement) + A.heap.pop(IndexMinEl) + A.min_heapify(minelement) + return minelement + + def DecreaseValue(A, ind, value): + if(ind <= A.heap.count()): + if(A.heap[ind] > value): + A.heap[ind] = value + A.min_heapify(A.heap, ind) + + def Insert(A, value): + A.heap.append(value) + A.min_heapify(len(A.heap)-1) + + def min_heapify(A, ind): + left = 2*ind + right = 2*ind+1 + if left < A.size() and A.heap[left] < A.heap[ind]: + largest = left + else: + largest = ind + + if right < A.size() and A.heap[right] < A.heap[largest]: + largest = right + + if largest != ind: + A.heap[ind], A.heap[largest] = A.heap[largest], A.heap[ind] + A.min_heapify(A.heap, largest) + + def size(A): + return len(A.heap) + + def __init__(A): + A.heap = [] + + +def GetMedian(value): #Процедура визначення медіани для значення value + global Heap_low + global Heap_high + + if value <= Heap_low.max(): + Heap_low.Insert(value) + else: + Heap_high.Insert(value) + + if Heap_low.size() >= Heap_high.size() + 2: + m = Heap_low.DelAndReturnMaxEl() + Heap_high.Insert(m) + elif Heap_high.size() >= Heap_low.size() + 2: + m = Heap_high.DelAndReturnMinEl() + Heap_low.Insert(m) + + #Вирахувати поточну медіану + #якщо кількість елементів парна, то повертаємо найбільший з Heap_low і найменший з Heap_high + if (Heap_low.size() + Heap_high.size())%2 == 0: + return (Heap_low.max() , Heap_high.min()) + #якщо кількість елементів непарна, то повертаємо найбільший з Heap_high і найменший з Heap_low + elif Heap_low.size() > Heap_high.size(): + return Heap_low.max() + else: + return Heap_high.min() + + +Heap_low = MaxHeap() #незростаюча піраміда для збереження меншої половини масиву +Heap_high = MinHeap() #неспадна піраміда для збереження більшої половини масиву + + #our main +input = open("input.txt", 'r') +n = int(input.readline()) +A = [] +for element in input: + A.append(int(element)) +input.close + +output = open('is01_sperkach_06_output.txt', 'w') +for ind in range(n): + output.write(str(GetMedian(A[ind]))+"\n") #визнаємо медіану підмасиву A +output.close() + diff --git a/Lab6_TA_HeapSort-master/input.txt b/Lab6_TA_HeapSort-master/input.txt new file mode 100644 index 0000000..c8274bf --- /dev/null +++ b/Lab6_TA_HeapSort-master/input.txt @@ -0,0 +1,16 @@ +15 +8 +6 +5 +10 +13 +7 +2 +4 +9 +3 +15 +12 +11 +14 +1 \ No newline at end of file diff --git a/Lab6_TA_HeapSort-master/is01_sperkach_06_output.txt b/Lab6_TA_HeapSort-master/is01_sperkach_06_output.txt new file mode 100644 index 0000000..4d318c0 --- /dev/null +++ b/Lab6_TA_HeapSort-master/is01_sperkach_06_output.txt @@ -0,0 +1,15 @@ +8 +(6, 8) +6 +(6, 8) +8 +(7, 8) +7 +(6, 7) +7 +(6, 7) +7 +(7, 8) +8 +(8, 9) +8 diff --git a/MakeRandomLists-master/ebaniy random ok/Debug/ebaniy random ok.exe b/MakeRandomLists-master/ebaniy random ok/Debug/ebaniy random ok.exe new file mode 100644 index 0000000..45852b1 Binary files /dev/null and b/MakeRandomLists-master/ebaniy random ok/Debug/ebaniy random ok.exe differ diff --git a/MakeRandomLists-master/ebaniy random ok/Debug/ebaniy random ok.ilk b/MakeRandomLists-master/ebaniy random ok/Debug/ebaniy random ok.ilk new file mode 100644 index 0000000..2533815 Binary files /dev/null and b/MakeRandomLists-master/ebaniy random ok/Debug/ebaniy random ok.ilk differ diff --git a/MakeRandomLists-master/ebaniy random ok/Debug/ebaniy random ok.pdb b/MakeRandomLists-master/ebaniy random ok/Debug/ebaniy random ok.pdb new file mode 100644 index 0000000..10783dc Binary files /dev/null and b/MakeRandomLists-master/ebaniy random ok/Debug/ebaniy random ok.pdb differ diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok.sln b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok.sln new file mode 100644 index 0000000..851e618 --- /dev/null +++ b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30621.155 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ebaniy random ok", "ebaniy random ok\ebaniy random ok.vcxproj", "{CA682191-663C-4C7C-A3C3-97219D561C17}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CA682191-663C-4C7C-A3C3-97219D561C17}.Debug|x64.ActiveCfg = Debug|x64 + {CA682191-663C-4C7C-A3C3-97219D561C17}.Debug|x64.Build.0 = Debug|x64 + {CA682191-663C-4C7C-A3C3-97219D561C17}.Debug|x86.ActiveCfg = Debug|Win32 + {CA682191-663C-4C7C-A3C3-97219D561C17}.Debug|x86.Build.0 = Debug|Win32 + {CA682191-663C-4C7C-A3C3-97219D561C17}.Release|x64.ActiveCfg = Release|x64 + {CA682191-663C-4C7C-A3C3-97219D561C17}.Release|x64.Build.0 = Release|x64 + {CA682191-663C-4C7C-A3C3-97219D561C17}.Release|x86.ActiveCfg = Release|Win32 + {CA682191-663C-4C7C-A3C3-97219D561C17}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E10608C7-AFB2-4253-88B0-44A67C76F3C8} + EndGlobalSection +EndGlobal diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.exe.recipe b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.exe.recipe new file mode 100644 index 0000000..55cb76e --- /dev/null +++ b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.exe.recipe @@ -0,0 +1,11 @@ + + + + + C:\Users\An-PC\source\repos\ebaniy random ok\Debug\ebaniy random ok.exe + + + + + + \ No newline at end of file diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.log b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.log new file mode 100644 index 0000000..8b23e5e --- /dev/null +++ b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.log @@ -0,0 +1,2 @@ + ebaniy random ok.cpp + ebaniy random ok.vcxproj -> C:\Users\An-PC\source\repos\ebaniy random ok\Debug\ebaniy random ok.exe diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.obj b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.obj new file mode 100644 index 0000000..aede2b7 Binary files /dev/null and b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.obj differ diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/CL.command.1.tlog b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/CL.command.1.tlog new file mode 100644 index 0000000..bfb6dfa Binary files /dev/null and b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/CL.command.1.tlog differ diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/CL.read.1.tlog b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/CL.read.1.tlog new file mode 100644 index 0000000..82be94f Binary files /dev/null and b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/CL.read.1.tlog differ diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/CL.write.1.tlog b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/CL.write.1.tlog new file mode 100644 index 0000000..ea06740 Binary files /dev/null and b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/CL.write.1.tlog differ diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/ebaniy random ok.lastbuildstate b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/ebaniy random ok.lastbuildstate new file mode 100644 index 0000000..d3aa3e9 --- /dev/null +++ b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/ebaniy random ok.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.18362.0: +Debug|Win32|C:\Users\An-PC\source\repos\ebaniy random ok\| diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/link.command.1.tlog b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/link.command.1.tlog new file mode 100644 index 0000000..7c44525 Binary files /dev/null and b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/link.command.1.tlog differ diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/link.read.1.tlog b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/link.read.1.tlog new file mode 100644 index 0000000..d291c34 Binary files /dev/null and b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/link.read.1.tlog differ diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/link.write.1.tlog b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/link.write.1.tlog new file mode 100644 index 0000000..d9061de Binary files /dev/null and b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/ebaniy random ok.tlog/link.write.1.tlog differ diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/vc142.idb b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/vc142.idb new file mode 100644 index 0000000..940efb5 Binary files /dev/null and b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/vc142.idb differ diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/vc142.pdb b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/vc142.pdb new file mode 100644 index 0000000..d6f6698 Binary files /dev/null and b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/Debug/vc142.pdb differ diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/ebaniy random ok.cpp b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/ebaniy random ok.cpp new file mode 100644 index 0000000..c44b327 --- /dev/null +++ b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/ebaniy random ok.cpp @@ -0,0 +1,95 @@ +#include +#include +#include +#include + + +using namespace std; + +int getRandomNumber(int, int); +void output(vector); + + +vector list = +{ +"Абрамчук Павло", +"Адамов Денис", +"Бойко Олег", +"Боярчук Марiя", +"Бутирський Олег", +"Василiв Богдан", +"Возняк Софiя", +"Волков Дмитро", +"Гусак Михайло", +"Даньков Артем", +"Дон Василь", +"Дудукчян Карина", +"Зєнцов Владислав", +"Катанов Дмитро", +"Клеба Олександра", +"Коберник Юлiя", +"Коваль Вадим", +"Колосенко Анна", +"Косюк Олексiй", +"Копайгородська Дар'я", +"Кубай Дмитро", +"Макарчук Павло", +"Меркур'єв Олег", +"Мiхненко Анна", +"Прунь Артем", +"Рибчинський Назарiй", +"Серветнiк Богдан", +"Сперкач Анна", +"Стеблина Дмитро", +"Толмачов Антон", +"Трачук Юлiя", +"Удачин Артем", +"Яцюк Сергiй", +}; + + + +int main() +{ + vector group_1; + vector group_2; + setlocale(LC_ALL, "Ukr"); + int integer = 0; + srand(static_cast(time(0))); + while ((group_1.size() == 17 && group_2.size() == 16) || !(group_1.size() == 16 && group_2.size() == 17)) + { + group_1.clear(); + group_2.clear(); + for (int i = 0; i < 33; i++) + { + integer = getRandomNumber(1, 2); + if (integer == 1) + { + group_1.push_back(list[i]); + } + else if (integer == 2) + { + group_2.push_back(list[i]); + } + } + } + cout << "Пiдгрупа №1:" << endl; + output(group_1); + cout << "_____________________________________" << endl; + cout << "Пiдгрупа №2:" << endl; + output(group_2); + return 0; +} + +int getRandomNumber(int min, int max) +{ + static const double fraction = 1.0 / (static_cast(RAND_MAX) + 1.0); + return static_cast(rand() * fraction * (max - min + 1) + min); +} + +void output(vector a) +{ + for (auto const& element : a) + std::cout << element << endl; +} + diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/ebaniy random ok.vcxproj b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/ebaniy random ok.vcxproj new file mode 100644 index 0000000..a1a2ca8 --- /dev/null +++ b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/ebaniy random ok.vcxproj @@ -0,0 +1,147 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {ca682191-663c-4c7c-a3c3-97219d561c17} + ebaniyrandomok + 10.0 + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + + + false + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/ebaniy random ok.vcxproj.filters b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/ebaniy random ok.vcxproj.filters new file mode 100644 index 0000000..e3b874f --- /dev/null +++ b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/ebaniy random ok.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/ebaniy random ok.vcxproj.user b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/ebaniy random ok.vcxproj.user new file mode 100644 index 0000000..0f14913 --- /dev/null +++ b/MakeRandomLists-master/ebaniy random ok/ebaniy random ok/ebaniy random ok.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/TA_4Laba-master/4Lab_TATA.sln b/TA_4Laba-master/4Lab_TATA.sln new file mode 100644 index 0000000..7efaa9c --- /dev/null +++ b/TA_4Laba-master/4Lab_TATA.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30907.101 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "4Lab_TATA", "4Lab_TATA.pyproj", "{D5674543-1710-46C2-80A5-989F05FC090F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D5674543-1710-46C2-80A5-989F05FC090F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D5674543-1710-46C2-80A5-989F05FC090F}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7B7281D4-A113-4446-92F0-3A6A79B6196E} + EndGlobalSection +EndGlobal diff --git a/TA_4Laba-master/_4Lab_TATA.py b/TA_4Laba-master/_4Lab_TATA.py new file mode 100644 index 0000000..8f894b6 --- /dev/null +++ b/TA_4Laba-master/_4Lab_TATA.py @@ -0,0 +1,144 @@ +def QuickSort(A,p,r): #the procedure of quick sort + count = 0 + if p < r: + q, CountTemp = ClassicPartition(A, p, r) + count += CountTemp + count += QuickSort(A, p, q-1) + count += QuickSort(A, q+1, r) + return count + +def ClassicPartition(A, p, r): #the procedure of classic partition + x = A[r] + i = p-1 + counter = 0 + for j in range(p, r): + counter += 1 + if A[j] <= x: + i += 1 + A[i], A[j] = A[j], A[i] + A[i+1], A[r] = A[r], A[i+1] + return i+1, counter + +def MedianQuickSort(A, p, r): #the procedure of improved quick sort by the mediana + count = 0 + if p 3: + mid = ((p + r) // 2) + middle = A[mid] + if A[p] < middle < A[r] or A[r] < middle < A[p]: + x = middle + elif middle < A[p] < A[r] or A[r] < A[p] < middle: + x = A[p] + else: + x = A[r] + index = A.index(x) + A[r], A[index] = A[index], A[r] + x = A[r] + i = p - 1 + counter = 0 + for j in range(p, r): + counter += 1 + if A[j] <= x: + i += 1 + A[i], A[j] = A[j], A[i] + A[i + 1], A[r] = A[r], A[i + 1] + return i + 1, counter + +def ThreePivotPartition(A, left, right): #the procedure of three pivots partition + counter = 0 + a = left +2 + b = left +2 + c = right -1 + d = right -1 + p = A[left] + q = A[left+1] + r = A[right] + + while b<=c: + while A[b]q and b<=c: + counter +=1 + if A[c]>r: + A[c], A[d] = A[d], A[c] + d -=1 + c -=1 + if b<=c: + if A[b] > r: + if A[c] < p: + A[b], A[a] = A[a], A[b] + A[a], A[c] = A[c], A[a] + a +=1 + else: + A[b], A[c] = A[c], A[b] + A[c],A[d]=A[d],A[c] + b +=1 + c -=1 + d -=1 + else: + if A[c] 3: + q, CountTemp = ThreePivotPartition(A, p, r) + count += CountTemp + count += ThreePivotQuickSort(A, p, q-1) + count += ThreePivotQuickSort(A, q+1, r) + return count + +def main(): #our main + file = open("input.txt") + read = file.read() + file.close() + A = [] + A = list(map(int, read.splitlines())) + n = A[0] + del A[0] + A2 = A + A3 = A + + counter1 = QuickSort(A, 0, n - 1) + counter2 = MedianQuickSort(A2, 0, n - 1) + counter3 = ThreePivotQuickSort(A3, 0, n-1) + + result = [counter1, counter2, counter3] + FileResult = open('is01_sperkach_04_output.txt', 'w') + for i in range(0, 3): + FileResult.write(str(result[i]) + " ") +main() diff --git a/TA_4Laba-master/input.txt b/TA_4Laba-master/input.txt new file mode 100644 index 0000000..fa2af7a --- /dev/null +++ b/TA_4Laba-master/input.txt @@ -0,0 +1,101 @@ +100 +80 +78 +36 +50 +20 +9 +29 +64 +17 +1 +69 +45 +83 +60 +59 +28 +54 +7 +71 +97 +48 +74 +76 +8 +53 +75 +42 +67 +15 +43 +30 +94 +3 +55 +18 +5 +77 +56 +44 +37 +22 +100 +4 +47 +84 +40 +10 +63 +58 +88 +24 +2 +68 +32 +90 +19 +81 +39 +21 +51 +85 +96 +87 +49 +95 +61 +65 +46 +93 +91 +92 +16 +26 +33 +82 +25 +62 +31 +38 +11 +34 +12 +99 +14 +6 +66 +57 +73 +23 +89 +52 +35 +27 +72 +79 +98 +41 +86 +70 +13 \ No newline at end of file diff --git a/TA_4Laba-master/is01_sperkach_04_output.txt b/TA_4Laba-master/is01_sperkach_04_output.txt new file mode 100644 index 0000000..e66841d --- /dev/null +++ b/TA_4Laba-master/is01_sperkach_04_output.txt @@ -0,0 +1 @@ +22 22 22 \ No newline at end of file diff --git a/ta_1lab_theory-of-algorithms-master/TA_Lab1_Sperkach_IS-01/TA_Lab1_Sperkach_IS-01.pyproj b/ta_1lab_theory-of-algorithms-master/TA_Lab1_Sperkach_IS-01/TA_Lab1_Sperkach_IS-01.pyproj new file mode 100644 index 0000000..17d7fad --- /dev/null +++ b/ta_1lab_theory-of-algorithms-master/TA_Lab1_Sperkach_IS-01/TA_Lab1_Sperkach_IS-01.pyproj @@ -0,0 +1,35 @@ + + + Debug + 2.0 + 5fb425ef-3583-416c-a51a-8cd057a582cd + . + TA_Lab1_Sperkach_IS_01.py + + + . + . + TA_Lab1_Sperkach_IS-01 + TA_Lab1_Sperkach_IS-01 + + + true + false + + + true + false + + + + + + + + + + + + \ No newline at end of file diff --git a/ta_1lab_theory-of-algorithms-master/TA_Lab1_Sperkach_IS-01/TA_Lab1_Sperkach_IS-01.sln b/ta_1lab_theory-of-algorithms-master/TA_Lab1_Sperkach_IS-01/TA_Lab1_Sperkach_IS-01.sln new file mode 100644 index 0000000..0d1a9c4 --- /dev/null +++ b/ta_1lab_theory-of-algorithms-master/TA_Lab1_Sperkach_IS-01/TA_Lab1_Sperkach_IS-01.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30907.101 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "TA_Lab1_Sperkach_IS-01", "TA_Lab1_Sperkach_IS-01.pyproj", "{5FB425EF-3583-416C-A51A-8CD057A582CD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5FB425EF-3583-416C-A51A-8CD057A582CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5FB425EF-3583-416C-A51A-8CD057A582CD}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {19A9ADF6-6440-43EB-8742-02595572FAB6} + EndGlobalSection +EndGlobal diff --git a/ta_1lab_theory-of-algorithms-master/TA_Lab1_Sperkach_IS-01/TA_Lab1_Sperkach_IS_01.py b/ta_1lab_theory-of-algorithms-master/TA_Lab1_Sperkach_IS-01/TA_Lab1_Sperkach_IS_01.py new file mode 100644 index 0000000..c639ca6 --- /dev/null +++ b/ta_1lab_theory-of-algorithms-master/TA_Lab1_Sperkach_IS-01/TA_Lab1_Sperkach_IS_01.py @@ -0,0 +1,47 @@ + +#сортуємо бульбашкою за порядком від парним до непарних +def pairnepair(arr): + for i in range(len(arr)): + for j in range(len(arr)): + if (j < len(arr) - 1) and (arr[j] % 2 != 0) and (arr[j + 1] % 2 == 0): + arr[j], arr[j+1] = arr[j+1], arr[j] + num = 0 + +#сортування бульбашкою парні за зростанням +def sortpair(arr, num): + for i in range(num): + for j in range(num): + if j < num - 1 and arr[j] > arr[j+1]: + arr[j], arr[j+1] = arr[j+1], arr[j] + +#сортування бульбашкою непарні за спаданням +def sortunpair(arr, num): + for i in range(num, len(arr)): + for j in range(num, len(arr)): + if j < len(arr) - 1 and arr[j] < arr[j+1]: + arr[j], arr[j+1] = arr[j+1], arr[j] + + + + +print("Бульбашкове сортування:") +num = 0 +print("Несортований масив:") +arr = [30, 19, 9, 15, 55, 24, 3, 78, 46, 41] +print(arr) +pairnepair(arr) + +for x in range(len(arr)): + if arr[x] % 2 == 0: + num += 1 + +sortpair(arr, num) +sortunpair(arr, num) + +print("Bubble sort:") +print(arr) + + + +print("Improved Bubble sort:") +print(arr)