전체 글
-
Windows Terminal 테마, 설정컴퓨터/소프트웨어 2020. 8. 2. 13:09
Windows Terminal 1. (옵션) Powershell 최신 버전 설치 https://github.com/PowerShell/PowerShell/releases Releases · PowerShell/PowerShell PowerShell for every system! Contribute to PowerShell/PowerShell development by creating an account on GitHub. github.com 2. 모듈 설치 Install-Module posh-git -Scope CurrentUser -Force Install-Module oh-my-posh -Scope CurrentUser -Force posh-git과 oh-my-posh를 설치한다. (거의 zsh f..
-
Docker + Flask 튜토리얼컴퓨터/파이썬 2020. 7. 30. 22:14
Docker 1. 사전 준비 Docker, WSL2 (윈도우를 위한 Linux 시스템) WSL 2 Linux용 Windows 하위 시스템 2 docs.microsoft.com 아래 flask-app.zip 압축 해제한다. 2. DockerFile 우선 DockerFile 구조를 한 번 살펴보겠다. FROM python:3 # set a directory for the app WORKDIR /app # copy all the files to the container COPY . . # install dependencies RUN pip install --no-cache-dir -r requirements.txt # tell the port number the container should expose EX..
-
Probabilistic Programming (확률적 프로그래밍)컴퓨터/소프트웨어 2020. 7. 29. 14:44
Hakaru hakaru-dev/hakaru A probabilistic programming language. Contribute to hakaru-dev/hakaru development by creating an account on GitHub. github.com Pyro(from Uber AI) 처럼 확률적 프로그래밍 언어인 Hakaru를 사용하는 법을 알아보겠다. 1. 설치법 우선 Git, mingw-64가 설치되어야 한다. 그다음, Haskell Tool Stack을 다운받아서 설치한다. (다운로드) (stack 설치 경로 : AppData\Local\Programs\stack) 1. git repositoy clone Hakaru를 clone할 곳에서 Git Bash를 열고, 다음을 입력한..
-
티스토리 highlight JS 코드 복사 플러그인컴퓨터/HTML & JS & TS 2020. 7. 23. 14:48
highlight JS Badge https://github.com/RickStrahl/highlightjs-badge RickStrahl/highlightjs-badge Addon component to highlightjs that lets you copy code snippets to the clipboard and displays the active syntax - RickStrahl/highlightjs-badge github.com 소개 : @RcikStrahl라는 분의 highlight JS badge를 티스토리에 적용하는 방법을 소개하겠습니다. 우선 아래 처럼, 코드 우측 상단에 배지가 생기고, 클릭하면 코드가 복사되는 플러그인입니다. 클래스 안에 codebadge를 추가하고, clicke..
-
파이썬 A* (A-star) 최단 경로 찾기 알고리즘컴퓨터/파이썬 2020. 7. 20. 16:02
A* 길 찾기 알고리즘은 1968년에 Peter Hart, Nils Nilsson, Bertram Raphael에 의해 최초 공개됐다. 우선 Node 클래스는 아래와 같이 구현될 것이며, 아래 클래스를 보고 글을 읽으면 좀 더 편할 것이다. class Node: def __init__(self, parent=None, position=None): self.parent = parent # 이전 노드 self.position = position # 현재 위치 self.f = 0 self.g = 0 self.h = 0 ex) 노드의 현재 위치는 xy좌표계를 사용한다. start = (0, 0), end = (9,9) aStar(star, end) -> Node(None, start) F = G + H 우선 A..
-
파이썬 Introspective Sort (내성 정렬) 알고리즘컴퓨터/파이썬 2020. 7. 17. 15:31
Introspective Sort IntroSort (Introspective Sort) 인트로 정렬은, Quick Sort의 장점을 유지하면서, 최악 시나리오 O(n^2)를 해결하려 만들어진 (Quick Sort + Heap Sort + Insertion Sort) 하이브리드 알고리즘이다. (C++ 기본 정렬 알고리즘, std::sort) 모든 상황에서 시간 복잡도 : O(nlogn), 공간 복잡도는 O(logn)이며, inplace, not stable한 알고리즘이다. (in-place란, 보조 데이터 구조를 사용하지 않고, 작동하는 알고리즘) Quick Sort로 시작해서, Recursion max-depth (log(len(array)) 에 도달하면 Heap Sort로 정렬하고, 그리고, 파티션 ..
-
파이썬 array.sort(), TimSort 알고리즘컴퓨터/파이썬 2020. 7. 16. 21:34
Tim Sort 소개 (Insert + Merge) TimSort 는 파이썬, 자바, Swift, Rust stable에서 기본으로 탑재된 sort() 함수의 알고리즘이다. 최고 O(n) 시간 복잡도를 갖고, stable 하며, 다양한 데이터에 적합한 정렬 알고리즘이다. (시간 복잡도 : 최상(n), 평균(nlogn), 최악(nlogn), 공간 복잡도 : n) (이 글에서 구현된 timSort는 계산해보면 모든 케이스에서 nlogn이 나온다) (정렬 알고리즘에서 안정성(stability)란 값이 원래 순서(order)를 갖고 정렬을 할 수 있냐, 없냐이다.) TimSort 는 두 가지 정렬 알고리즘을 섞은 것인데, 바로 Insertion과 Merge이다. (Quick Sort는 unstable, Merg..
-
Python BFS(너비 탐색) 및 Iterative Deepening Depth-first Search컴퓨터/파이썬 2020. 7. 11. 20:50
IDDFS 1. 소개 반복적 깊이 증가 (IDDFS)는 깊이 우선 탐색(DFS)처럼 메모리 필요량이 깊이 제한에 비례하면서도 최단 경로로 목표 노드를 찾는 것을 보장하는 방법이다. IDDFS 방법에서는 목표 노드가 찾아질 때까지 깊이 제한을 1 씩 증가시키면서 연속적인 깊이 우선 탐색을 수행한다. 아래 그래프를 반복적 깊이 증가 탐색을 해보면 다음과 같다. 깊이 제한 1 = A -> B -> C -> D 깊이 제한 2 = A -> B -> E -> F -> C -> D -> G -> H 깊이 제한 3 = A -> B -> E-> F -> I -> J -> C -> D -> G -> H -> K ... 2. Node class 우선 Node 클래스를 만들어 준다. class Node: def __init_..