728x90 merge_sort1 [Python] Codility ArrayInversionCount An array A consisting of N integers is given. An inversion is a pair of indexes (P, Q) such that P Write an efficient algorithm for the following assumptions:N is an integer within the range [0..100,000];each element of array A is an integer within the range [−2,147,483,648..2,147,483,647]. 당연히 하나씩 비교했을 시 O($N^{2}$)이 되므로 이를 개선할 필요성이 있다.이 때 보통 병합정렬(merge sort)을 사용한다. 병합정렬은 분할(divide), 정복(conquer.. 2025. 4. 15. 이전 1 다음 728x90