Skip to content

Instantly share code, notes, and snippets.

View ellynhan's full-sized avatar
🍊
Working from home

Jaewon Han ellynhan

🍊
Working from home
  • Samsung Electronics
View GitHub Profile
@ellynhan
ellynhan / I'm a night 🦉
Last active January 6, 2022 00:55
⭐️my commit style ⭐️
🌞 Morning 129 commits ███▉░░░░░░░░░░░░░░░░░ 18.7%
🌆 Daytime 159 commits ████▊░░░░░░░░░░░░░░░░ 23.0%
🌃 Evening 257 commits ███████▊░░░░░░░░░░░░░ 37.2%
🌙 Night 145 commits ████▍░░░░░░░░░░░░░░░░ 21.0%
@ellynhan
ellynhan / QuickSort.cpp
Created February 20, 2020 11:52
Blog Code Sample
#include <iostream>
using namespace std;
void swap(int& a, int& b){ // pivot을 int&으로 선언해야하는 이유. 그렇지않으면 값만 복사하기때문에 실제 값이 변하지 않는다.
int t=a; a=b; b=t;
}
void partition(int* A, int low, int high){
if(low>=high) return;
int& pivot=A[high]; //가장 오른쪽에 있는 수를 pivot으로 설정
int i=low-1, j=low; //i는 pivot이 들어갈 자리를 정해주는 포인터역할, j는 값 비교를 위한 포인터역할
@ellynhan
ellynhan / MergeSort.cpp
Last active February 20, 2020 11:52
Blog Code Samples
#include <iostream>
using namespace std;
void merge(int* A,int begin, int mid, int end, int* B){ // 분할해둔 배열의 값을 크기비교하여 정렬하고 합친다.
int i,j,k;
i=begin;
j=mid;
for(k=begin; k<=end; k++){//정렬하면서 배열B에 차례로 넣어 줄 것.
// 분할된 블럭중 i는 왼쪽블럭담당, j는 오른쪽 블럭담당이다.
// j가 end보다 커졌다는 의미는 i담당인 왼쪽블럭만 남았다는 이야기이다.