- 博客(7)
- 收藏
- 关注
原创 Leetcode刷题记——50. Pow(x, n)
一、题目叙述: Implement pow(x, n). 二、解题思路: Medium题。&参考。 思路: 递归实现,注意n为负时,不能用 1 / mypow(x, -n)。 三、源码: public class Solution { public double m
2017-04-13 23:08:19 329
原创 Leetcode刷题记—— 4. Median of Two Sorted Arrays(两有序数组的中位数)
一、题目叙述: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh
2017-04-12 20:02:32 365
原创 背景
一、B-树: public class BTreeSET > { private Page root = new Page(true); public BTreeSET(Key sentinel) { add(sentinel); } public boolean contains(Key key) { return contains(root, key); } priv
2017-04-10 11:11:07 267 1
原创 数据压缩
一、Huffman压缩: public class Huffman { private static int R = 256; private static class Node implements Comparable { private Node left, right; private int freq; private char ch; Node(char ch
2017-04-08 10:55:41 255
原创 正则表达式
一、NFA的构造与匹配: public class NFA { private int M; private Digraph G; private char[] re; public NFA(String regexp) { Stack ops = new Stack(); M = regexp.length(); G = new Digraph(M+1); re
2017-04-07 10:47:49 232
原创 子字符串查找
一、暴力子字符串查找算法: public class Baoli { public static int search(String pattern, String txt) { int M = pattern.length(); int N = txt.length(); for (int i = 0; i < N-M; i++) { int j; for (
2017-04-06 11:37:23 238
原创 单词查找树
一、基于单词查找树的符号表: public class TrieST { private Node root; private static int R = 256; private static class Node { private Object val; private Node[] next = new Node[R]; } public Value get(Str
2017-04-05 21:23:01 317
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人