- 遍历当前节点距离为1的邻接节点
- 存在目的节点,搜索结束
- 如果不为目的节点,将邻接节点周围距离为1的节点加入带检查的节点队列中
- 对待检查节点中的节点运用重复步骤1
This file contains hidden or 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
function levenshteinDistance(strA, strB) { | |
// Function to calculate levenshtein distance of two string | |
// Algorithm description: http://en.wikipedia.org/wiki/Levenshtein_distance | |
if (strA == strB) { return 0; } | |
if (!strA || !strB) { return strA.length || strB.length; } | |
var distance = [], lenA = strA.length, lenB = strB.length; | |
for (var i=0; i <= lenA; i++) { distance[i] = [i]; } |
This file contains hidden or 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
public class LineReader { | |
public static List<String> splitCSV(String str, char delimiter, char escape) { | |
boolean isClose = true; | |
boolean isEscaped = false; | |
List<String> result = new ArrayList<String>(); | |
StringBuilder sb = new StringBuilder(); | |
for (char c : str.toCharArray()) { | |
if (c == delimiter) { |
This file contains hidden or 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 random | |
import operator | |
import argparse | |
from collections import defaultdict | |
def count(usernames, iter_times): | |
result = defaultdict(lambda: 0) | |
for _ in range(0, iter_times): |
This file contains hidden or 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
(let ((default-font (font-spec :name "Ubuntu Mono" :size 15)) | |
(cn-font (font-spec :name "Sarasa Mono SC"))) | |
(set-frame-font default-font) | |
(dolist (charset '(kana han symbol cjk-misc bopomofo)) | |
(set-fontset-font t charset cn-font))) |