This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package openhome.algorithm.sorting; | |
import java.util.*; | |
public class MergeSort { | |
private static void merge(int[] first, int[] second, int[] result) { | |
int iFirst = 0; | |
int iSecond = 0; | |
int j = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Comparator; | |
import java.util.PriorityQueue; | |
class MedianFinder { | |
private PriorityQueue<Integer> lH; | |
private PriorityQueue<Integer> rH; | |
public MedianFinder() { | |
lH = new PriorityQueue<Integer>(11, new Comparator<Integer>() { | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Map; | |
public class Trie { | |
private TrieNode root; | |
public Trie() { | |
root = new TrieNode(); | |
} | |
public void insert(String word) { | |
Map<Character, TrieNode> children = root.children; | |
for (int i = 0; i < word.length(); i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.Map; | |
public class TrieNode { | |
char c; | |
Map<Character, TrieNode> children = new HashMap<Character, TrieNode>(); | |
boolean isWord; | |
public TrieNode() {} | |
public TrieNode(char c) {this.c = c;} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Map; | |
import java.util.HashMap; | |
//public class DoubleLinkedListNode { | |
// public int val; | |
// public int key; | |
// public DoubleLinkedListNode pre; | |
// public DoubleLinkedListNode next; | |
// public DoubleLinkedListNode(int key, int value) { | |
// this.key = key; | |
// val = value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
github | |
~~~~~~ | |
Port of the github color scheme. | |
Based upon the pygments-style-railscasts_ of Marcus Fredriksson. | |
.. _pygments-style-railscasts: http://github.com/DrMegahertz/pygments-style-railscasts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.codehilite pre .hll { background-color: #ffffcc } | |
.codehilite pre { background: #f6f8fa; font-family: Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace !important;} | |
.codehilite pre .c { color: #999988; font-style: italic } /* Comment */ | |
.codehilite pre .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |
.codehilite pre .k { color: #000000; font-weight: bold } /* Keyword */ | |
.codehilite pre .o { color: #000000; font-weight: bold } /* Operator */ | |
.codehilite pre .ch { color: #999988; font-style: italic } /* Comment.Hashbang */ | |
.codehilite pre .cm { color: #999988; font-style: italic } /* Comment.Multiline */ | |
.codehilite pre .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */ | |
.codehilite pre .cpf { color: #999988; font-style: italic } /* Comment.PreprocFile */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# django | |
from django import forms | |
from django.utils.safestring import mark_safe | |
from django.utils.functional import cached_property | |
# wagtail | |
from wagtail.wagtailcore.blocks import (TextBlock, | |
StructBlock, | |
CharBlock, | |
ChoiceBlock) | |
# 3rd party |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream example_server { | |
server unix:/the/path/to/the/applicatoin/sock/example.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name example.com; | |
client_max_body_size 4G; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream example_server { | |
server unix:/the/path/to/the/applicatoin/sock/example.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name example.com; | |
return 301 https://example.com$request_uri; | |
} |
OlderNewer