본문 바로가기 메뉴 바로가기

robustflame의 블로그

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

robustflame의 블로그

검색하기 폼
  • 분류 전체보기 (15)
    • 알고리즘 이론 (6)
    • 알고리즘 문제 풀이 (9)
  • 방명록

sort (1)
Counting Sort, Radix Sort

Counting Sort 계수 정렬(Counting Sort)은 총 \(n\)개의 원소가 1에서 \(k\)의 범위에 있을 때, 선형 시간복잡도 \(O(n+k)\)를 가지는 빠른 정렬 방법이다. \(O(nlog_2n)\)의 시간복잡도를 가지는 Merge Sort, Heap Sort, Quick-Sort 같은 정렬법보다도 빠르게 동작한다. 단, 원소의 범위가 1에서 \(n^2\)이라면 \(O(n^2)\)의 시간복잡도를 가지게 되는 제약이 있다. 구현#include using namespace std; void countSort(char arr[], int range) { char newArr[strlen(arr)]; int cnt[range + 1] = { 0 }; for (int i = 0; arr[i];..

알고리즘 이론 2017. 2. 23. 15:42
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • greedy
  • constructive algorithms
  • BFS
  • Minimum Spanning Tree
  • branch and bound
  • divide and conquer
  • parametric search
  • Square root decomposition
  • Fenwick Tree
  • sliding window
  • math
  • Data structure
  • Dynamic Programming
  • search
  • kmp search
  • implementation
  • karatsuba
  • suffix array
  • Segment Tree
  • Heap
  • Graph
  • pattern matching
  • tree
  • Binary search
  • sort
  • Strings
more
«   2025/09   »
일 월 화 수 목 금 토
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
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바