Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- hackerrank
- Algorithm
- 격파르타 후기
- [sqld]자격증합격
- 머신러닝
- Interview Preparation Kit
- 백준
- 파이썬
- programmers
- 프로그래머스
- 매칭점수
- 격파르타 장점
- Reverse Shuffle Merge
- 피보나치 함수
- python
- Recursion: Davis' Staircase
- DFS: Connected Cell in a Grid
- Special String Again
- 알고리즘
- 구슬탈출2
- 코딩테스트
- 격파르타 합격후기
- BFS: Shortest Reach in a Graph
- candies
- 야근지수
- Roads and Libraries
- Common Child
- Find the nearest clone
- Max Array Sum
- 해커랭크
Archives
- Today
- Total
목록병합정렬 (1)
Archive
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/ENwku/btqG69b1HE6/Jw2aHDDABVEdDKKcLc3M5K/img.png)
https://www.hackerrank.com/challenges/ctci-merge-sort/problem Merge Sort: Counting Inversions | HackerRank How many shifts will it take to Merge Sort an array? www.hackerrank.com 풀이 예제처럼 bubble sort로 구현하면 timeout 발생 merge sort로 구현해도 timeout 발생함 merge 부분에서 list의 append함수를 지역 변수로 사용하는게 빠름. 필요한 정보들( len(list) 등)을 미리 변수에 할당하고 사용하는게 빠름. 가운데 index를 계산해 둘 씩 나누다가, 합칠 때 inversion 경우를 count함. i < j 일 때, a..
공부/Algorithm
2020. 8. 25. 14:19