<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[MiTKooK's Tech Log]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/mitkook</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; mitkook]]></copyright><item><title><![CDATA[a nice article about /dev/urandom vs /dev/random]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/48306437</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/48306437</guid><author>mitkook</author><pubDate>Wed, 09 Sep 2015 02:37:42 +0800</pubDate><description><![CDATA[original post at: http://www.2uo.de/myths-about-urandom/ 

Myths about /dev/urandom
by Thomas Hühn
There are a few things about /dev/urandom and /dev/random that are repeated again and again. Stil]]></description><category></category></item><item><title><![CDATA[port forwarding in yosemite, a way to replace ipfw]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/40447047</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/40447047</guid><author>mitkook</author><pubDate>Sat, 25 Oct 2014 05:02:23 +0800</pubDate><description><![CDATA[Mac OS Yosemite disabled ipfw command, we need use pf rule to work around it. This article is a manual to describe how to address this issue.]]></description><category></category></item><item><title><![CDATA[The Best Interview Questions for Would-be C++ Programmers]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/12996939</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/12996939</guid><author>mitkook</author><pubDate>Thu, 24 Oct 2013 13:41:37 +0800</pubDate><description><![CDATA[The Best Interview Questions for Would-be C++ Programmers
http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=tenBestQuestions
http://community.topcoder.com/tc?module=Static&d1=tutorials&]]></description><category></category></item><item><title><![CDATA[Java is Pass-by-Value, Dammit!]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/12824873</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/12824873</guid><author>mitkook</author><pubDate>Thu, 17 Oct 2013 02:55:09 +0800</pubDate><description><![CDATA[THIS ARTICLE CONFIRMS MY UNDERSTANDING ON JAVA. ENJOY IT.
original post: http://javadude.com/articles/passbyvalue.htm


----------------------------------------------------------------------------]]></description><category></category></item><item><title><![CDATA[Add mappings to an Elasticsearch index in realtime]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/12740695</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/12740695</guid><author>mitkook</author><pubDate>Tue, 15 Oct 2013 05:05:13 +0800</pubDate><description><![CDATA[Changing mapping on existing index is not an easy task. You may find
 the reason and possible solutions in here:
http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/



to get]]></description><category></category></item><item><title><![CDATA[Elasticsearch template configuration]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/12740653</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/12740653</guid><author>mitkook</author><pubDate>Tue, 15 Oct 2013 04:51:56 +0800</pubDate><description><![CDATA[Index templates allow defining templates thatwill automatically be applied to new indices created. The templates may include(1) settings, (2) mappings, or (3) a simple index pattern template thatcontr]]></description><category></category></item><item><title><![CDATA[整形数组找回路]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/10248101</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/10248101</guid><author>mitkook</author><pubDate>Sat, 24 Aug 2013 04:31:01 +0800</pubDate><description><![CDATA[一个整形数组，存储的是下一跳的位置，就像指针一样。
比如A[0]=2  A[1]=3  A[2]=1  A[3]=1  A[4]=3
就这么跳：0 2 1 3 1 3...，于是找到了一个loop，长度为2，由1、3这两个元素组成。
题目就是给出这样的数组，返回loop长度。
要求O(N) time，O(1) space.


int findLoop(int* arr, int a]]></description><category></category></item><item><title><![CDATA[shallow copy and deep copy （浅拷贝 vs 深拷贝）]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/8071451</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/8071451</guid><author>mitkook</author><pubDate>Mon, 15 Oct 2012 08:25:50 +0800</pubDate><description><![CDATA[a.浅拷贝(Shallow Copy)：只复制对象的基本类型,对象类型,仍属于原来的引用。
 b.深拷贝(Deep Copy)：不仅复制对象的基本类,同时也复制原对象中的对象.完全产生新对象。

也就是说，shallow copy 只会拷贝原值，对于指针指向的内存空间，也仅仅拷贝其地址。而deep copy不仅拷贝原值，对于指针指向的内存空间，也做嵌套复制。
The default cop]]></description><category></category></item><item><title><![CDATA[建堆的算法复杂度分析 O(n)]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/8058682</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/8058682</guid><author>mitkook</author><pubDate>Thu, 11 Oct 2012 05:18:30 +0800</pubDate><description><![CDATA[代码：
template inline void MaxHeap::make_heap(vector & v) {
	if (heap_.size() != 0)
		heap_.clear();
	heap_ = v;

	// start with last parent, and reheapify_down back to root
	for (int i = parent(v.size]]></description><category></category></item><item><title><![CDATA[Career Cup 150 (version 4.0) C++ Solution (Git Repositories)]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/7922474</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/7922474</guid><author>mitkook</author><pubDate>Thu, 30 Aug 2012 00:47:10 +0800</pubDate><description><![CDATA[CareerCup 150 ：欢迎一起解题练习，在github上建了Repositories，有兴趣就来fork吧： 
https://github.com/mitkook/Career-Cup-CPP-Solutions.git



This project try to implement career cup 150 (ver. 4.0) exercises using C++.]]></description><category></category></item><item><title><![CDATA[数组找missing元素]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/7434107</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/7434107</guid><author>mitkook</author><pubDate>Fri, 06 Apr 2012 23:10:58 +0800</pubDate><description><![CDATA[大小N的数组有 N-k个不同的数， 范围0-N， 找missing
要求用O(1) space



发信人:
 longway2008 (longway2008), 信区: JobHunting
标  题: Re: 问个题：大小N的数组有 N-k个不同的数， 范围0-N， 找miss
发信站: BBS 未名空间站 (Fri Apr  6 07:07:24 2012, 美东)]]></description><category></category></item><item><title><![CDATA[maximum subarray]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/7431951</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/7431951</guid><author>mitkook</author><pubDate>Fri, 06 Apr 2012 13:34:24 +0800</pubDate><description><![CDATA[经典面试题


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]]></description><category></category></item><item><title><![CDATA[Edit Distance]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/7425300</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/7425300</guid><author>mitkook</author><pubDate>Wed, 04 Apr 2012 12:25:43 +0800</pubDate><description><![CDATA[有两个字符串s 和 u， 问最少的步数从s转换倒u。

转换的方法，

从s任意取一个substring，然后可以执行以下三种操作

Insert one letter to any end of the string.
Delete one letter from any end of the string.
Change one letter into any other on]]></description><category></category></item><item><title><![CDATA[两个大数相乘]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/7424582</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/7424582</guid><author>mitkook</author><pubDate>Tue, 03 Apr 2012 22:42:28 +0800</pubDate><description><![CDATA[两个大数相乘 char* multiply(char*,char*);
给了两个字符串，每个都是代表了一个很长的10进制表示的数
比如 char str1[] = "23456789009877666555544444"
char str2[] = "346587436598437594375943875943875"
最后求出他们的乘积



string multiply(st]]></description><category></category></item><item><title><![CDATA[找公共次数最多的点]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/7422673</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/7422673</guid><author>mitkook</author><pubDate>Mon, 02 Apr 2012 23:02:32 +0800</pubDate><description><![CDATA[giving lots of intervals [ai, bi], find a point intersect with the most 
number of intervals

要nlogn的解法


【 在 utar (由它) 的大作中提到: 】
: 把所有ai, bi合起来排序每点保留记号标明是a还是b,2nlog(2n)(还算O(nlogn)吧),然
: 后从头扫描]]></description><category></category></item><item><title><![CDATA[众数问题]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/7417744</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/7417744</guid><author>mitkook</author><pubDate>Sun, 01 Apr 2012 03:10:02 +0800</pubDate><description><![CDATA[How to find if a number is present >= (n / 2) times in an array of size
n? 
关于这个题目，有没有时间复杂度是O(n)，空间复杂度是O(1)的解？


solution by swanswan @ MitBBS
int number=a[0];
int count=1;
for (int i=1; i<n; i+]]></description><category></category></item><item><title><![CDATA[Rotating an array in place]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/7417655</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/7417655</guid><author>mitkook</author><pubDate>Sun, 01 Apr 2012 00:28:26 +0800</pubDate><description><![CDATA[发信人: swanswan (swan), 信区: JobHunting
标  题: Rotating an array in place
发信站: BBS 未名空间站 (Thu Mar 29 02:00:55 2012, 美东)

0 1 2 3 4 5 6 7  (N=8, k=3)
->
3 4 5 6 7 0 1 2

leetcode上那个要移动2N次，写了个只要移动N次]]></description><category></category></item><item><title><![CDATA[微软亚洲研究院提供的面试题分析]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/7381584</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/7381584</guid><author>mitkook</author><pubDate>Thu, 22 Mar 2012 04:11:21 +0800</pubDate><description><![CDATA[http://www.msra.cn/talks/ItemList.aspx?type=Bop]]></description><category></category></item><item><title><![CDATA[稳定排序问题，要求O(n)时间，O(1)空间]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/7377648</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/7377648</guid><author>mitkook</author><pubDate>Wed, 21 Mar 2012 13:28:35 +0800</pubDate><description><![CDATA[问题：

微软： 给定一个 Integer Array，只有正数和负数。使让所有正数排在所有负数后面，所有正数间相对位置不变，所有负数间相对位置不变。要求
 In-Place，空间复杂度 O(1)。
Facebook：一个记录数组，每个记录的关键字是0，1，2三个数中的一种，要求将数组按关键字排序。要求算法是稳定排序，O(n)时间，常数空间。
Amazon：一个数组，包含positive]]></description><category></category></item><item><title><![CDATA[Longest Subarray with Equal "1" and "0"]]></title><link>https://blog.youkuaiyun.com/mitkook/article/details/7376893</link><guid>https://blog.youkuaiyun.com/mitkook/article/details/7376893</guid><author>mitkook</author><pubDate>Wed, 21 Mar 2012 10:37:20 +0800</pubDate><description><![CDATA[Problem: Given an array that only contains "1" and "0", find the longest subarray which contains equal number of "1" and "0".
Solution: With
 hash table, we can have a O(N) solution. The detail is a]]></description><category></category></item></channel></rss>