IT와 비즈니스를 연결하다.

[TIL 23] 퀴즈 2750번 본문

"Today I Learned" 30일 프로젝트

[TIL 23] 퀴즈 2750번

sujiinsight 2019. 5. 29. 23:20

number_of_numbers = int(input())
nums = [int(input()) for i in range(number_of_numbers)]

def mergeSort(x):
    if len(x) > 1:
        mid_point = len(x)//2
        left_x = x[:mid_point]
        right_x = x[mid_point:]

 

        mergeSort(left_x)

        mergeSort(right_x)

 

        left_index, right_index, x_index = 0, 0, 0
        while left_index < len(left_x) and right_index < len(right_x):
            if left_x[left_index] < right_x[right_index]:
                x[x_index] = left_x[left_index]
                left_index += 1
            else:
                x[x_index] = right_x[right_index]
                right_index += 1
            x_index += 1

'"Today I Learned" 30일 프로젝트' 카테고리의 다른 글

[TIL 25] 정렬 문제  (0) 2019.05.31
[TIL 24] 2nd ver. 2163번  (0) 2019.05.30
[TIL 22] 2163번 수정렬 문제  (0) 2019.05.28
[TIL 21] Pandas 활용하기  (0) 2019.05.27
[TIL 20] Class 리뷰_Python  (0) 2019.05.26