Skip to content

Instantly share code, notes, and snippets.

@rollue
rollue / dynamic_array.py
Created March 1, 2018 10:27
Python implementation of dynamic_array(only append method)
# -*- coding: utf-8 -*-
""" Python implementation of dynamic arrays
Available class:
- DynamicArray: 배열 내 빈 공간의 유무에 상관없이 마지막 인덱스에 데이터를
추가할 수 있는 메소드를 가지는 클래스
TODO:
- delete() 구현
@rollue
rollue / insertion_sort.py
Created March 1, 2018 05:17
Python implementation of insertion sort
# -*- coding: utf-8 -*-
__author__ = 'Myong-Hoon Jeon'
from unittest import main, TestCase
def insertion_sort(li):
""" Python implementation of insertion sort
args:
@rollue
rollue / quick_sort(randomized in-place quick_sort).py
Last active February 28, 2018 10:15
Python implementation of randomized in-place quicksort algorithm
# -*- coding: utf-8 -*-
# python implementation of quicksort using Divide and Conquer
import random
from unittest import TestCase, main
__author__ = "Myong-Hoon Jeon"
@rollue
rollue / quick_sort(simple recursion).py
Last active February 28, 2018 10:14
Python implementations of quick sort(simple recursion version)
# -*- coding: utf-8 -*-
# python implementation of quicksort using Divide and Conquer
import random
from unittest import TestCase, main
__author__ = "Myong-Hoon Jeon"
@rollue
rollue / merge_sort.py
Created February 27, 2018 07:18
Python implementation of merge sort
# -*- coding: utf-8 -*-
__author__ = "Myong-Hoon Jeon"
from unittest import TestCase, main
def merge(sorted_leftlist, sorted_rightlist):
""" Get two sorted lists and merge into one
args:
@rollue
rollue / selection_sort.py
Last active February 26, 2018 05:35
Python implementation of selection sort algorithm
# -*- coding: utf-8 -*-
__author__ = 'Myong-Hoon Jeon'
from unittest import TestCase, main
def selection_sort(input_list):
""" 선택정렬 구현
args:
@rollue
rollue / bubble_sort.py
Created February 25, 2018 08:06
python implementation of bubble sort
# -*- coding: utf-8 -*-
from unittest import TestCase, main
__author__ = 'MH Jeon'
def bubble_sort(li):
""" Python implementation of bubble sort
args:
@rollue
rollue / binary_search.py
Created February 23, 2018 23:14
python implementation of binary search
# -*- coding: utf-8 -*-
from unittest import TestCase, main
__author__ = "MH Jeon"
def binary_search(data, target, low, high):
""" Binary search 구현