Skip to content

Instantly share code, notes, and snippets.

@rollue
rollue / vim_cheatsheet.md
Created March 25, 2018 00:38 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@rollue
rollue / Q1-find-nearest-two-points.py
Created March 24, 2018 02:17
Q1-find-nearest-two-points.py
"""
# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
num_of_lines = 2
for i in range(num_of_lines):
if i == 0:
total_num = int(input())
else:
num_list = [int(x) for x in input().split()]
@rollue
rollue / binary_search_tree.py
Created March 9, 2018 04:17
Python implementation of binary search tree; add, search, delete
# -*- coding: utf-8 -*-
from unittest import TestCase, main
__author__ = 'MH Jeon'
class Node:
def __init__(self, data):
@rollue
rollue / queue.py
Created March 5, 2018 16:45
Simple implementatin of queue
from unittest import main, TestCase
class Node:
def __init__(self, data, next):
self._data = data
self._next = next
def __repr__(self):
from unittest import main, TestCase
class Node:
def __init__(self, data, next):
self._data = data
self._next = next
def __repr__(self):
# -*- coding: utf-8 -*-
__author__ = "MH Jeon"
import os
from unittest import main, TestCase
import sys
""" Solution for EPI 8.1: Implement stack with max API """
@rollue
rollue / doubly_linked_list.py
Created March 4, 2018 10:57
implement doubly linked list
# -*- coding: utf-8 -*-
__author__ = "Myong-Hoon Jeon"
from unittest import main, TestCase
class Node:
""" 연결리스트의 Node. """
@rollue
rollue / refactored_merge_two_ordered_lists.py
Created March 4, 2018 09:01
Refactored merge two ordered lists
def refactored_merge_two_sorted_lists(L1, L2):
dummy_head = tail = Node()
cur1 = L1
cur2 = L2
while cur1 and cur2:
if cur1.data < cur2.data:
tail.next, cur1 = cur1, cur1.next
else:
tail.next, cur2 = cur2, cur2.next
# -*- coding: utf-8 -*-
__author__ = "MH Jeon"
import os
from unittest import main, TestCase
import sys
from linked_list import LinkedList
from unittest import main, TestCase
class Node:
""" 연결리스트의 Node. """
def __init__(self, data=None, next=None):
self.data = data
self.next = next