12 2009 档案

Ex 10.4-3 of introduction to algorithms
摘要:Question:Write an O(n)-time nonrecursive procedure that, given an n-node binary tree, prints out the key of each node in the tree. Use a stack as an auxiliary data structure. Answer:This isn't a d... 阅读全文

posted @ 2009-12-24 17:04 rxwen 阅读(225) 评论(0) 推荐(0)

Ex 9.3-8 of Introduction to algorithms
摘要:Question:Let X[1 .. n] and Y [1 .. n] be two arrays, each containing n numbers already in sorted order. Give an O(lg n)-time algorithm to find the median of all 2n elements in arrays X and Y.Answer:Wi... 阅读全文

posted @ 2009-12-17 08:49 rxwen 阅读(224) 评论(0) 推荐(0)

use memcmp to compare objects?
摘要:I came across a question regarding c++, is it more efficient to use memcmp to determine equality of two objects of the same type.This is not a question regarding efficiency at all, it's about correctn... 阅读全文

posted @ 2009-12-11 09:13 rxwen 阅读(284) 评论(0) 推荐(0)

communicate with service on android
摘要:While doing android programming, it's a common sense to use Activity to interact with users and use Service to perform time consuming tasks (actually, such tasks are usually performed on a new thread ... 阅读全文

posted @ 2009-12-09 08:50 rxwen 阅读(278) 评论(0) 推荐(0)

windows side by side assemblies
摘要:There are times when I deployed an application on a box different from the developing box, the application failed to start with following message:"This application has failed to start because the appl... 阅读全文

posted @ 2009-12-07 08:30 rxwen 阅读(442) 评论(0) 推荐(0)

Ex5.1-3 of Introduction to Algorithms
摘要:Question: Suppose that you want to output 0 with probability 1/2 and 1 with probability 1/2. At your disposal is a procedure BIASED-RANDOM, that outputs either 0 or 1. It outputs 1 with some probabili... 阅读全文

posted @ 2009-12-04 13:04 rxwen 阅读(239) 评论(0) 推荐(0)

main thread in android application
摘要:In android sdk document, it's mentioned that all components(Activity, Service, etc) run on the main thread. The main thread is the thread where our code works on.Conventionally, when talk about a Serv... 阅读全文

posted @ 2009-12-04 08:48 rxwen 阅读(527) 评论(0) 推荐(0)

Ex5.1-2 of introduction to algorithms
摘要:A friend asked my idea about the exercise 5.1-2 of introduction to algorithms. Here is the original question:Question:Describe an implementation of the procedure RANDOM(a, b) that only makes calls to ... 阅读全文

posted @ 2009-12-02 08:25 rxwen 阅读(220) 评论(0) 推荐(0)

导航