<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>竹简中的桃源 &#187; java</title>
	<atom:link href="http://codingliyi.com/archives/tag/java/feed" rel="self" type="application/rss+xml" />
	<link>http://codingliyi.com</link>
	<description>诸天浩瀚，神魔流转，天苍苍兮云山远，心悠悠兮梦桃源</description>
	<lastBuildDate>Fri, 27 Jan 2012 09:02:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>一道Google2009夏季实习生招聘笔试程序设计题</title>
		<link>http://codingliyi.com/archives/2009/04/520</link>
		<comments>http://codingliyi.com/archives/2009/04/520#comments</comments>
		<pubDate>Thu, 16 Apr 2009 05:37:24 +0000</pubDate>
		<dc:creator>紫色竹简</dc:creator>
				<category><![CDATA[木甲工房]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[程序]]></category>
		<category><![CDATA[笔试]]></category>
		<category><![CDATA[算法]]></category>

		<guid isPermaLink="false">http://www.codingliyi.com/archives/2009/04/520</guid>
		<description><![CDATA[最近这道题在blogjava和javaeye上出现频率很高，中午花了点时间我也实现了一下。 原题： 要求：写一个函数void count(char* input,int len)，此函数的功能是计算出一个字符串中每个字符的个数，不区... ]]></description>
			<content:encoded><![CDATA[<p>最近这道题在blogjava和javaeye上出现频率很高，中午花了点时间我也实现了一下。</p>
<p>原题：</p>
<p>要求：写一个函数void count(char* input,int len)，此函数的功能是计算出一个字符串中每个字符的个数，不区分大小写，输出结果时按字符在字符串中出现的先后顺序。使用程序语言不限。    <br />例如：input=&quot;abCc*b&quot;，输出结果是a:1 b:2 c:2 *:1</p>
<p>我的java实现，借助了一个Map和两个List换时间，时间复杂度应该是O(n)：</p>
<blockquote><p>import java.io.BufferedReader;      <br />import java.io.IOException;       <br />import java.io.InputStreamReader;       <br />import java.util.ArrayList;       <br />import java.util.HashMap; </p>
</blockquote>
<p> <span id="more-520"></span><br />
<blockquote>
<p>public class Google2009 {</p>
<p>&#160;&#160; public static void main(String[] args) {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; BufferedReader sin = new BufferedReader(new InputStreamReader(System.in));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; String input;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; input = sin.readLine();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new Google2009().count(input, input.length());       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (IOException e) {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160; }       <br />&#160;&#160;&#160; public void count(String input, int len){       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; HashMap&lt;Character, Integer&gt; charMap = new HashMap&lt;Character, Integer&gt;();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ArrayList&lt;Integer&gt; countList = new ArrayList&lt;Integer&gt;();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ArrayList&lt;Character&gt; charList = new ArrayList&lt;Character&gt;();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; input = input.toLowerCase();&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; for(int i=0; i&lt;len; ++i){       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; char c = input.charAt(i);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(charMap.containsKey(c)){       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; int index = charMap.get(c);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; countList.set(index, countList.get(index)+1);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; charList.add(c);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; countList.add(1);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; charMap.put(c, countList.size()-1);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; for(int i=0; i&lt;charList.size(); ++i){       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(charList.get(i) + &quot;:&quot; + countList.get(i));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160; } </p>
<p>}</p>
</blockquote>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li>2008-12-16 -- <a href="http://codingliyi.com/archives/2008/12/40" title="CD Manager 0.99发布">CD Manager 0.99发布</a></li><li>2008-09-07 -- <a href="http://codingliyi.com/archives/2008/09/45" title="有些鸟是不能关在笼子里的">有些鸟是不能关在笼子里的</a></li><li>2007-06-14 -- <a href="http://codingliyi.com/archives/2007/06/71" title="转角遇上爱">转角遇上爱</a></li><li>2007-05-26 -- <a href="http://codingliyi.com/archives/2007/05/75" title="我眼中的软件工程专业">我眼中的软件工程专业</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://codingliyi.com/archives/2009/04/520/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>CD Manager 0.99发布</title>
		<link>http://codingliyi.com/archives/2008/12/40</link>
		<comments>http://codingliyi.com/archives/2008/12/40#comments</comments>
		<pubDate>Mon, 15 Dec 2008 19:01:00 +0000</pubDate>
		<dc:creator>紫色竹简</dc:creator>
				<category><![CDATA[木甲工房]]></category>
		<category><![CDATA[CD Manager]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[电脑]]></category>
		<category><![CDATA[软件]]></category>

		<guid isPermaLink="false">http://www.codingliyi.com/archives/2008/12/40</guid>
		<description><![CDATA[        这是参加NWPU“富士通”杯软件设计大赛的作品，谢谢姜哲，谢谢自己，谢谢我们的合作。虽然软件有很多的缺陷，我们也有许多尚未完成的遗憾，但是，我们一起把它做出来了。从1... ]]></description>
			<content:encoded><![CDATA[<p>        这是参加NWPU“富士通”杯软件设计大赛的作品，谢谢姜哲，谢谢自己，谢谢我们的合作。虽然软件有很多的缺陷，我们也有许多尚未完成的遗憾，但是，我们一起把它做出来了。从11月份开始，近20天里，我们一起经历了从构思、分析、设计、编码、测试的过程，就像看着自己孩子一样一点点看着它从无到有、慢慢成长，这就够了。<br />
        之所以命名为0.99版，主要是受雷军先生Bitlok的影响。我们也觉得确实它还有许多不足，不愿意贸然就赋予它1.0的称谓。这也算是一个鞭策，我们希望以此为起点，奋然前行。</p>
<p>        软件是用Java编写的，经过多次查询资料和实验，我们最终将80M的JRE精简到6M，制成了可以完全脱离Java环境独立执行的发布版。如果有人需要Jar版（约4M），请与我联系。<br />
<span id="more-40"></span><br />
CD Manager 0.99 下载地址：</p>
<p>        华军软件：<a href="http://www.onlinedown.net/soft/77809.htm" target="_blank">http://www.onlinedown.net/soft/77809.htm</a><br />
        新浪科技：<a href="http://down1.tech.sina.com.cn/download/downContent/2004-03-16/1744.shtml" target="_blank">http://down1.tech.sina.com.cn/download/downContent/2004-03-16/1744.shtml</a><br />
        中关村在线：<a href="http://xiazai.zol.com.cn/detail/34/337774.shtml" target="_blank">http://xiazai.zol.com.cn/detail/34/337774.shtml</a><br />
        绿色软件联盟：<a href="http://www.xdowns.com/soft/10/147/2008/Soft_48601.html" target="_blank">http://www.xdowns.com/soft/10/147/2008/Soft_48601.html</a><br />
        SupFree: <a href="http://www.supfree.com/soft/soft.asp?v_id=50660" target="_blank">http://www.supfree.com/soft/soft.asp?v_id=50660</a></p>
<p>源码在此下载：<br />
        <a title="CD Manager源码" href="http://www.blogjava.net/Files/codingliyi/CDManagerSrc.rar">CD Manager源码</a><br />
        <a title="CD Manager文档" href="http://www.blogjava.net/Files/codingliyi/CDManagerDoc.rar">CD Manager文档</a></p>
<p>CD Manager 简介：<br />
　　CD Manager是一款使用简单、功能强大的个人光盘管理软件。它采用Java语言编写，具有以下强大功能：<br />
　　一、光盘扫描。随着电脑硬件技术的不断发展，各类刻录设备渐渐成为电脑的标准配置。光盘以其大容量、低成本、高安全的特点成为了使用最为广泛的数据存储工具。随着时间的推移，用户手中可能已经积累了数十上百张光盘。如何对它们进行有效管理便成为了一大难题。CD Manager将为用户解决这一烦恼！用户只需把光盘放入光驱，启动CD Manager对其扫描，光盘上的文档相关信息便被建立成索引文件存储起来。<br />
　　二、光盘查看。对于建立索引后的光盘，用户不需要将其放入光驱，就可以在CD Manager中直接查看其目录结构，就像查看本地硬盘文件一般便捷简单。用户也可以删除、修改曾经创建过的光盘。<br />
　　三、光盘搜索。如果用户要查找某个文件，只需在搜索栏中输入关键字，只要该文件所在的光盘已被创建过索引，那么用户便能瞬间得到查得该文件在哪一张光盘上。CD Manager支持通配符搜索、模糊搜索、组合搜索等多种搜索方式。<br />
　　四、导出索引。光盘的索引包含了该光盘上所有文件的文件名及文件路径等信息。CD Manager可以把他们导出为txt文件，方便用户作其他使用。<br />
　　五、硬盘搜索。同建立光盘索引类似，只要用户对本地硬盘(也可以是硬盘上的一个分区或是一个文件夹)建立了索引，那么也可以在不到一秒的时间内瞬间搜索到所需要的结果。<br />
　　六、密码设置。用户可以设置CD Manager的启动密码，保障个人光盘数据不被他人查看，有效的保护了用户的隐私。<br />
　　七、日志记录。对于用户的每一个关键操作，CD Manager都会生成日志记录下来。用户可以随时查看，也可以将日志记录导出为txt文件。</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li>2006-01-24 -- <a href="http://codingliyi.com/archives/2006/01/135" title="不了轩辕情">不了轩辕情</a></li><li>2009-04-16 -- <a href="http://codingliyi.com/archives/2009/04/520" title="一道Google2009夏季实习生招聘笔试程序设计题">一道Google2009夏季实习生招聘笔试程序设计题</a></li><li>2008-03-31 -- <a href="http://codingliyi.com/archives/2008/03/57" title="我记忆中的那些电脑游戏们（一）">我记忆中的那些电脑游戏们（一）</a></li><li>2008-03-21 -- <a href="http://codingliyi.com/archives/2008/03/58" title="我记忆中的那些电脑游戏们（零）">我记忆中的那些电脑游戏们（零）</a></li><li>2007-08-16 -- <a href="http://codingliyi.com/archives/2007/08/63" title="记偶的第一个本本">记偶的第一个本本</a></li><li>2007-05-26 -- <a href="http://codingliyi.com/archives/2007/05/75" title="我眼中的软件工程专业">我眼中的软件工程专业</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://codingliyi.com/archives/2008/12/40/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

