自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Allen Yang's Column

Explore the world with brain.

  • 博客(63)
  • 收藏
  • 关注

原创 Six months internship at MSRA

Until June 17, I will have been interning at MSRA for half a year. During this period, I have learned a lot and made a large number of new friends. Frankly speaking, MSRA has the best research environ

2009-05-23 14:09:00 640

原创 A problem during the compilation of Lemur and the solution

Last night I spent over an hour compiling the whole Lemur-4.7 project from its source code using cygwin on Windows XP platform according to the instructions shown at its official website. During the c

2008-12-18 23:17:00 969 1

原创 Harmonious layouts for n queens in a n*n chessboard

 This is also a typical and famous problem. Its prototype is 8 queens problem in a 8*8 chessboard, whereas we can extend it to n queens problem in a n*n chessboard. The purpose of this problem is to f

2008-12-11 10:28:00 536

原创 Horse moves and returns to its starting position in a chessboard

This is a typical problem of searching. From the problem itself, we know that recursive programming is suitable to solve it. Below is the c++ code to calculate the total number of possible routes for

2008-12-10 23:47:00 634

原创 Represent an integer by the sum of at least two consecutive integers

There are some integers which can be represented by the sum of at least two consecutive integers. For example, 3 = 1 + 2, 9 = 4 + 5 = 2 + 3 + 4, 15 = 1 + 2 + 3 + 4 + 5 = 4 + 5 + 6 = 7 + 8, 18 = 5 + 6

2008-12-03 22:35:00 698

原创 Compute the maximal length of the increasing subsequence in an array

The idea to solve this problem goes as follows: Suppose there is an array of n element A. If the maximal length of the increasing sequence lying within the first k elements is known, denoted as L(k),

2008-12-02 21:42:00 499

原创 A very efficient and economical way to shift an array

 How do you shift an array? For example, there is an array {a, b, c, d, 1, 2, 3, 4}, and the requirement is to cyclic-shift 3 elements to the right. That means, after the shift, the array looks like t

2008-12-01 13:02:00 461

原创 Calculate the biggest sum of submatrix

 Lets continue the topic discussed in last article. What if we want to calculate the biggest sum of the submatrices of a matrix, which can be treated as a 2-D array? The usual idea is that we can sol

2008-11-26 14:55:00 952

原创 Calculate the biggest sum of subarray

 Given an array of integers, how to calculate the biggest sum of its subarrays? This is a typical problem and is solved in almost every textbook about algorithm, especially about dynamic programming.

2008-11-25 14:11:00 468

原创 Find the biggest k numbers

Suppose that we want to find the biggest k numbers from a very large data set which costs a lot to read in the main memory (e.g., the data set is stored in hard disk and need to be fetched into the ma

2008-11-24 11:02:00 600

原创 A smart way to count the ONEs in an integer's binary form representation

There is a smart way to count the ONEs in an integers binary form representation (this way comes from the book "Beauty of Programming"). Its basic idea is that subtracting ONE from an integer will "c

2008-11-20 14:47:00 501

原创 Traverse a binary tree in a level-based order

Sometimes we need to traverse a binary tree in a level-based order rather than pre-, mid-, or post-order. For example, we may need to visit a trees nodes from the root level to the leaf level, and wi

2008-11-16 00:32:00 847

原创 Reconstruct a binary tree through its pre- and mid-order traversal sequences

When first learned binary tree at school, given a binary tree, there are three basic orders to traverse all its nodes (in fact there are more than three orders): pre-order, mid-order, and post-order.

2008-11-15 23:48:00 801

原创 Test the efficiency of the exclusion objects in Windows

There are mainly four kinds of exclusion objects, which can be used in solving the problems of race condition, on Windows platform. They are Critical Section, Mutex, Semaphore, and Event. As most peop

2008-04-03 13:44:00 561

原创 A wrapper of SGI STL memory allocator and deallocator

This article gives a wrapper of the SGI STL memory allocator and deallocator, providing a powerful tool for your own use directly. The header files needed are "alloc.h", "stl_config.h" and "stl_alloc.

2008-03-08 09:01:00 690

原创 Implement memory allocator and deallocator using the mechanism in SGI STL

STL is an amazing utility related to C++. In most cases, the vectors and algorithms can work very well, i.e., effectively and efficiently. The management of memory, allocation and deallocation, is wel

2008-03-07 08:57:00 780

原创 Memory management: default new & delete vs. allocator & deallocator using a pool

/***********************************************************************************************All rights reserved by Allen Young. Welcome to communicate and discuss. If you want to quote this articl

2008-03-01 10:21:00 641

原创 Build process of large projects

Most large projects use a build process to generate its distribution files. The typical steps are as follows: configure, create dependencies, build tools, build executables & build documentations, and

2008-02-14 20:33:00 461

原创 Common directory names of large projects and their meanings

I am sure when a person, especially a novice programmer, downloads a open source software package and decompresses it, he will get shocked by the many and complex directories and files of different ki

2008-02-13 22:48:00 607

原创 Inheritance in C++

Inheritance is really a big topic of C++. This article is only a general description of inheritance mechanism from my point of view.Basically, there are four kinds of inheritance: public, private, p

2008-02-11 22:29:00 646

原创 Some basic details of template in C++

 The introdution of template into C++ makes it more flexible and more capable to support generic design and programming. There are two usages, the template function and the template class. Although th

2008-02-04 00:35:00 531

原创 Function overloading in C++

Function overloading, which seems to be a simple topic, is in fact much more complicated than we expect. An excellent book (I read the third edition) provides a full cover on it.In short, there are

2008-01-31 17:22:00 750

原创 The first semester in PKU

 It is ten days since I arrived home. How time flies. One semester in PKU has passed. At the very first two months, I wasted a lot of time. I played computer games, I talked with friends online, I too

2008-01-29 00:05:00 827

原创 It is a long way...

New environment, new decision, new future. It is a long way to go...

2007-09-07 18:47:00 602

原创 Parallel program running in dual-core environment

Recently I have been studying parallel programming. Paralleled programs can get better performance in multicore machines. For example, a program creating two threads to do a job can reduce the executi

2007-08-08 21:55:00 1270 2

原创 Two more accurate ways to get time elapsed than clock()

The following program shows these two ways.#include #include #include #include #include inline unsigned _int32 get_cycles(){ _asm RDTSC}int main(){ unsigned _int32 start = 0, end = 0, result; 

2007-08-08 21:20:00 637

原创 CPU Identification

Here is some code to check out your cpu identification using CPUID instruction. Try it first.#include #include #include #include #include bool is_intel_cpu(){ char cpu_id[13];_asm {  MOV EAX, 0 

2007-08-08 20:17:00 633

转载 陈皓谈程序员升级:给新人程序员的八点建议

今年已经是陈皓在程序员行业里的第十个年头了。总结这十年,毕业的头两年,陈皓在银行中昏昏沉沉中度过,“这是我最失败的时候,两年的时间几乎完全白费了”。后来在上海的两年,我拼命地学习看书,并不断总结所做的项目,这个阶段是我补课的阶段,也是我量变的阶段。到了北京的这五年,是我从量质向质变转换的阶段。拼命看书刚毕业的时候,陈皓也像很多刚毕业的学生一样,根本没有对自己的职业进行过比较好的规划。“还记得当时什

2007-07-13 23:54:00 1592 2

原创 Use pthread_exit() To Terminate main() With The Other Threads Alive

When you program with POSIX Threads API, there is one thing about pthread_exit() that you may ignore for mistake. In subroutines that complete normally, there is nothing special you have to do unless

2007-07-13 13:01:00 750

原创 Three Methods to Parallel Programming Decomposition

The key point to write parallel programs is to treat the program as a set of many related or unrelated sub-tasks. The process that the program is divided into some independent sub-tasks and their rela

2007-07-08 17:20:00 560

原创 Communications of Processes and Threads

Communications of ProcessesThere are 5 ways for processes to communicate with each other.1. Environment Variable/File DescriptorThe child process inherits the copies of many kinds of resources o

2007-07-08 10:32:00 537

原创 Three classical IPC problems

1. The Dining Philosophers ProblemThe key point is to make sure that a philosopher should get two forks at one time, not separately. That means, one philosopher should check to see if he can get int

2007-07-04 16:36:00 1202

原创 The end, the new beginning

 Four years of college life has ended. There are so many memories of all kinds, which will accompany me forever. The bachelors degree is just a milestone in my life. It is an end of one period, also

2007-07-03 11:27:00 678 1

原创 Issues related to IPC

There are briefly three issues related to IPC (InterProcess Communication):1. How one process can pass information to another.2. How two or more processes dont get into each others way when enga

2007-05-02 20:39:00 934 4

原创 Do you know the sizes of these things in real memory?

It costs less time for CPU to read data from memory or write data into memory if the address of the data is divisible by the size of the data. So if there is an int stored in address "0", then a doubl

2007-04-22 17:12:00 652 4

原创 Virtual method and base-type pointer make polymorphism in C++

The core of object-oriented programming may be inheritance and polymorphism. C++ uses virtual method and base-type pointer to achieve this, which is different from Java. In Java, everything is object,

2007-04-21 21:46:00 618

原创 Something after main function exits

When the program runs to the end of the main function, or more strictly, returns some value in main(), it means the whole program is over. However, we can do something which is not executed within the

2007-04-21 20:33:00 594

原创 Some confusing mechanisms in Java

I am sure many people heard some concepts or mechanisms while learning Java and almost always got confused by differentiate them. These are: overload, override, hide, shadow, and obscure. Many books t

2007-04-15 16:12:00 452

原创 Print the bit pattern of a float

We can use bit shifting and bit-and operator to print out the bit pattern of an integer(a short, an int, a long, or even a char) easily. But how can we print out the bit pattern of a floating number(a

2007-04-08 10:42:00 853

原创 Pipes used for Interprocess Communication

"Interprocess communication in MINIX uses pipes. When a user typescat file1 file2 | sortthe shell creates a pipe and arranges for standard output of the first process to write to the pipe, so stan

2007-04-07 01:08:00 626

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除