随笔分类 -  JAVA

上一页 1 2

摘要:package com.thunisoft.in4.cm.associate.util;import java.util.List;import java.util.Map;/** * 编辑距离算法 * * @author fanxf * */public class HanziParse { /** * 计算矢量距离 Levenshtein Distance(LD) * * @param str1 * str1 * @param str2 * str2 * @return ... 阅读全文

posted @ 2013-12-27 17:22 迷途@书童 阅读(268) 评论(0) 推荐(0)

摘要:问题:有一个连续文件,其中保存了40亿个数字,其中有重复的数字,要求在不到1MB内存空间的前提下,寻找出现两次以上的数字。原理: 将这些数字读出来取其二进制编码,如:0000000100100011010001010110011110001001101010111100遍历这些串,首先取第一位,如果是0,存入文件1,如果是1,存入文件2;然后以文件1为输入,取第二位,判断第二位的数字再次进行分类。这样递归分析完所有的文件,重复的数字会被归并到一个文件中,单独出现的数字会保存到一个单独的文件中。以下是java代码实现,以16位长度为例:先制造数据:import java.io.IOExcep.. 阅读全文

posted @ 2013-12-27 17:00 迷途@书童 阅读(623) 评论(0) 推荐(0)

摘要:/* * Diff Match and Patch * * Copyright 2006 Google Inc. * http://code.google.com/p/google-diff-match-patch/ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * 阅读全文

posted @ 2013-12-27 16:43 迷途@书童 阅读(543) 评论(0) 推荐(0)

上一页 1 2

导航