- 博客(58)
- 资源 (4)
- 收藏
- 关注
原创 中文分词实现——双向最大匹配
关于中文分词的一些基本介绍,可以看这篇博客《中文分词方法总结》。这里就不再进行详细介绍了。双向最大匹配方法双向最大匹配方法是一种基于词典的分词方法。基于词典的分词方法是按照一定策略将待分析的汉字串与一个“大机器词典”中的词条进行匹配,若在词典中找到某个字符串,则匹配成功。按照扫描方向的不同:正向匹配和逆向匹配按照长度的不同:最大匹配和最小匹配正向最大匹配思想FM
2014-11-02 16:06:44 17770 8
原创 汉字自动注音程序
汉字注音在平时应用中,可能会有这样的需求:要给一些中文进行自动注音。这个程序就是根据这个需求实现的。思想汉字注音程序的思想主要是依赖一些已有的常用词的注音词表。对于给定的需要注音的汉字串text,首先对text进行分词。这里的分词方法采用了正向最大匹配和逆向最大匹配想结合的方法。然后根据注音词表中每个词是某个音的概率,得到一个最大可能的注音结果。思想很简单,
2014-11-01 20:07:39 3316
原创 [leetcode]Add Two Numbers
问题描述:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it
2014-11-27 22:48:30 753
原创 [leetcode]Anagrams
问题描述:Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.基本思路:对每个字符串进行排序,然后对排过序的字符串统计出现次数超过1次的。将这些超过1次的字符串的原始串加入结果集代码:
2014-11-27 20:28:40 639
原创 [leetcode]Longest Substring Without Repeating Characters
问题描述:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is
2014-11-27 19:37:41 756
原创 c++循环创建多级目录
今天项目中遇到了创建文件的需求,发现C++创建文件并不像java那样简单,所以在网上找了找相关的内容。记录下来,方便以后用到。c++中创建文件需要调用系统接口,所以不同的系统会有不同的实现方式。在windows下可以调用文件中的_mkdir(char* a);而linux下则是下的int mkdir(const char *path, mode_t mode)方法。#include "
2014-11-27 16:36:27 1072
原创 [leetcode]Tree inorder traversal
问题描述:Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].Note: Recursive solution
2014-11-26 22:09:30 714
原创 [leetcode]Longest Consecutive Sequence
问题描述:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [
2014-11-26 21:56:12 705
原创 [leetcode]Find Minimum in Rotated Sorted ArrayII
问题描述:Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Suppose a sorted array is rotated at som
2014-11-26 21:36:30 732
原创 [leetcode]Insert Interval
问题描述:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start time
2014-11-25 21:11:55 795
原创 [leetcode]Merge Intervals
问题描述:Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].基本思路:对左边界进行排序,然后对有边界的情况进行分类处理。代码:
2014-11-25 19:54:28 760
转载 计算机求职总结--准备篇
版权所有,转载请注明出处,谢谢!http://blog.csdn.net/walkinginthewind/article/details/13000431找工作是一个长期准备的过程,突击是没什么效果的。准备时间越长,准备就越充分,就越容易拿到好的offer。我基本上从研究生一入学就一直在准备找工作的东西,看书、研究研究笔试面试题、在线编程训练、参加实习招聘等等。当然,其实主要还是研二
2014-11-24 21:43:30 562
原创 [leetcode]Jump Game II
问题描述:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your
2014-11-24 20:29:03 745
原创 [leetcode]Trapping Rain Water
问题描述:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3
2014-11-24 19:57:29 912
原创 [leetcode]First Missing Positive
问题描述:Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run in O(n) time and uses con
2014-11-23 15:33:40 769
原创 [leetcode]Search in Rotated Sorted Array
问题描述:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array
2014-11-23 14:47:58 815
原创 [leetcode]Median of Two Sorted Arrays
问题描述:基本思想:代码: double findMedianSortedArrays(int A[], int m, int B[], int n) { //C++ int pre = 0; int midpos = (m+n)/2; bool isodd = (m+n)%2 == 1;
2014-11-23 14:04:15 726
原创 [leetcode]Construct Binary Tree from Inorder and Postorder Traversal
问题描述:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.基本思路:与前一篇《Construct Binary Tree from Preord
2014-11-23 10:42:20 824
原创 [leetcode]Construct Binary Tree from Preorder and Inorder Traversal
问题描述:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.基本思路:找到规律,递归的解决左子树和右子树。代码:/** * D
2014-11-23 10:26:36 1169
原创 [leetcode]Remove Duplicates from Sorted Array II
问题描述:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is now[
2014-11-19 21:18:12 790
原创 [leetcode]Search a 2D Matrix
问题描述:Write an efficient algorithm that searches for a value in anm x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer o
2014-11-19 20:52:23 735
原创 [leetcode]Minimum Path Sum
问题描述:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right whichminimizes the sum of all numbers along its path.Note: You can only move either down or
2014-11-19 20:35:41 757
原创 [leetcode]Maximum Subarray
问题描述:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray [4,−1,
2014-11-19 18:55:19 721
转载 最常用的C++序列化方案综述
导读1. 什么是序列化?2. 为什么要序列化?好处在哪里?3. C++对象序列化的四种方法4. 最常用的两种序列化方案使用心得正文1. 什么是序列化?程序员在编写应用程序的时候往往需要将程序的某些数据存储在内存中,然后将其写入某个文件或是将它传输到网络中的另一台计算机上以实现通讯。这个将程序数据转化成能被存储并传输的格式的过程被称为“序列化”(Serializa
2014-11-19 16:43:04 758
转载 C++对象序列化方案介绍
Introduction介绍 序列化是将对象状态信息转换为可存储或传输的过程,序列化时,对象会将当前状态写入到临时或持久性的存储区。以后,可以通过从存储区中读取或反序列化对象的状态,重新创建该对象。对象序列化反序列化通常用于: 将对象存储于硬盘上 在网络上传送对象的字节序列 更多介绍内容 常见C++序列化方案Boost.Serializati
2014-11-19 16:29:32 1442
原创 [leetcode]Jump Game
问题描述:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Dete
2014-11-18 22:19:34 754
原创 [leetcode]Rotate Image
问题描述:You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?基本思路:此题要求矩阵顺时针转90度。可以找出元素选择规律:i‘ = j;j
2014-11-18 21:35:42 762
原创 [leetcode]Search for a Range
问题描述:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order ofO(log n).If the target is not
2014-11-18 19:56:42 719
原创 [think in java]第12章 通过异常处理错误
异常处理是java中唯一正式的错误报告机制。并且通过编译器强行执行。异常参数抛出异常与方法正常返回值的区别:异常返回的“地点”与普通方法调用返回的"地点"完全不同。(异常将在一个恰当的异常处理程序中得到解决,他的位置可能离异常被抛出的地方很远,也可能会跨越方法调用栈的许多层次。)对异常来说,最重要的部分就是类名。捕获异常异常处理理论上有两种模型:终止模型和恢
2014-11-18 16:45:34 955
原创 [leetcode]Next Permutation
问题描述:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest p
2014-11-17 22:18:21 736
原创 [leetcode]3 Sum closest
问题描述:Given an array S of n integers, find three integers inS such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would ha
2014-11-16 10:27:35 1124
原创 [leetcode]3Sum
问题描述:Given an array S of n integers, are there elementsa, b, c in S such that a + b +c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet
2014-11-15 22:01:00 1001
原创 [leetcode]Container With Most Water
问题描述:Given n non-negative integers a1,a2, ..., an, where each represents a point at coordinate (i,ai). n vertical lines are drawn such that the two endpoints of linei is at (i, ai) and (i, 0
2014-11-13 22:02:30 713
转载 java hashMap和TreeMap区别深入理解
首先介绍一下什么是Map。在数组中我们是通过数组下标来对其内容索引的,而在Map中我们通过对象来对对象进行索引,用来索引的对象叫做key,其对应的对象叫做value
2014-11-13 14:23:27 788
原创 [leetcode]Set Matrix Zeroes
问题描述:基本思路:代码:void setZeroes(vector > &matrix) { set rows; set cols; int m = matrix.size(); if(m == 0) return ; int n = matr
2014-11-12 21:06:37 611
原创 [leetcode]Sort Colors
问题描述:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the in
2014-11-12 16:26:31 712
转载 那些年用过的swap函数
那些年用过的swap函数分类: LINUX 下的c开发 2012-07-03 19:48 1002人阅读 评论(0)收藏 举报 c目录(?)[-]前沿swap函数 用于交换 a b 两个数实现方法大同小异其中不乏有好多版本现在就其性能和可读性略作分析不对指出还望指正探讨实现分析性能分析稳定性可读性总结前沿swa
2014-11-12 16:03:42 765
中文汉字注音程序jar包 PYLabeler_v1.0.jar
2014-10-31
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人