Input: A[], p, r, where p < r.
Merge-Sort(A, p, r)
{
if ( p < r )
{
q = [(p + r)/2];
Merge-Sort(A, p, q);
Merge-Sort(A, q, r);
Merge(A, p, q, r);
}
}
Megre(A, p, q, r)
{
n1 = q - p + 1;
n2 = r - q;
for (i = 0; i <= n1; i++)
L[i] = A [p+i];
for (j = 0; j <= n2; j++)
R[j] = A[q+j];
L[n1 +1] = Sentinel;
R[n2 +1] = Sentinel;
i = j = 0;
for (k = p; k <= r; k++)
{
if (L[i] <= R[j])
{
A[k] = L[i];
i++;
}
else
{
A[k] = R[j];
j++;
}
}
}
Features:
1. loop invariant
2. stable
3. T(n) = O(nlgn)
I need to follow my heart.
Apr 9, 2009
Apr 8, 2009
Insertion Sort
Input: A[1..N], length[A]
for (j=2; j <= length[A]; j++)
{
key = A[j];
i = j-1;
while (A[i] > key && i > 0)
{
A[i+1] = A[i];
i--;
}
A[i+1] = key;
}
Features:
1. sort in place;
2. loop invariant;
3. stable sort;
for (j=2; j <= length[A]; j++)
{
key = A[j];
i = j-1;
while (A[i] > key && i > 0)
{
A[i+1] = A[i];
i--;
}
A[i+1] = key;
}
Features:
1. sort in place;
2. loop invariant;
3. stable sort;
Feb 16, 2009
Long time no update
I went home on 17th last month. Today, on 16th this month, I'm sitting in chair, working. One-month-time is quite easy to elapse before we catch its evanescent character.
This year will be a busy one, especially under current economic situation all over the world. In coming July, I will start to hunt for a job. There're merely four months left for me to get ready. These 120 days may be even shorter than spring vacation passed yet.
This period is paramount due to three reasons. The first is that job pressure requires me to acquire various knowledge on algorithms, cooperating, experiences in projects, to name just a few. The second stress comes from dissertation, including paper and master dissertation, which determine the Niubility extent of universities who give me offers. The third unsaid factor may influence my life time -- Delia. I have been being with her only for three days -- at my sister's wedding. Do you call this kind of encounter the predestined relationship? Maybe. She is now getting a driver's license at her hometown, but after that her parents will help her seek a job in Beijing, where I stay. I have known little about her habits, interests, temper, wants and likes, not even the color she favors. After she comes to my place, I will make more contacts with her and seriously consider whether asking her to be my GF or not.
From this week, from today, from current second, minute, hour, I am forced to work hard for my dreams, no matter how lazy I was. It seems a long time since I determined to do meaningful things. I have lost my passion, and now I am going to get it back.
This year will be a busy one, especially under current economic situation all over the world. In coming July, I will start to hunt for a job. There're merely four months left for me to get ready. These 120 days may be even shorter than spring vacation passed yet.
This period is paramount due to three reasons. The first is that job pressure requires me to acquire various knowledge on algorithms, cooperating, experiences in projects, to name just a few. The second stress comes from dissertation, including paper and master dissertation, which determine the Niubility extent of universities who give me offers. The third unsaid factor may influence my life time -- Delia. I have been being with her only for three days -- at my sister's wedding. Do you call this kind of encounter the predestined relationship? Maybe. She is now getting a driver's license at her hometown, but after that her parents will help her seek a job in Beijing, where I stay. I have known little about her habits, interests, temper, wants and likes, not even the color she favors. After she comes to my place, I will make more contacts with her and seriously consider whether asking her to be my GF or not.
From this week, from today, from current second, minute, hour, I am forced to work hard for my dreams, no matter how lazy I was. It seems a long time since I determined to do meaningful things. I have lost my passion, and now I am going to get it back.
Dec 10, 2008
Bless My Sister
Bad news, though the symptom is relatively minor.
The old saying always works: Body is the most important factor.
All of us should live a healthy lifestyle which contributes more and more to our physical bodies as we are walking towards the aged steadily.
* * * * * * * *
I should focus on my researches and paper, instead of checking msgs all the time. It is a bad habit for my success, and I know it exactly. Snior students in my lab told me that they felt it is extremely difficult to find an ideal job within a short time. They are now quite regretful of their wasting time before. Shouldn't I learn some lessons from their experiences? From now on, I will not run im softwares during work time. I swear.
Nov 11, 2008
Happy Single Day~
Next month will be a critical period for me. By the end of this weekend, I will submit all online applications and mail all supplemental materials, if time allows.
Just now, my collegue said that we would go on a biz travel to a province which hasn't been affirmed. The task is to deploy a report project. I would be happy to go if only I were in my undergraduate. Nevertheless, I am extremly boring to go now.
I cannot change this situation. The mere thing I can do now is to accept it and try to focus on my own researches.
Just now, my collegue said that we would go on a biz travel to a province which hasn't been affirmed. The task is to deploy a report project. I would be happy to go if only I were in my undergraduate. Nevertheless, I am extremly boring to go now.
I cannot change this situation. The mere thing I can do now is to accept it and try to focus on my own researches.
Oct 20, 2008
It's a war!
It definitely is.
SOP, CV, References, Transcripts, to name just a few, are all demanding, pushing things.
I surely like to study in first-class graduate schools, as anyone else does, but it seems quite difficult.
Thanks for everyone's help. I am really appreciated. I will not make you disappointed.
SOP, CV, References, Transcripts, to name just a few, are all demanding, pushing things.
I surely like to study in first-class graduate schools, as anyone else does, but it seems quite difficult.
Thanks for everyone's help. I am really appreciated. I will not make you disappointed.
Sep 11, 2008
Topic 5
5. A company has announced that it wishes to build a large factory near your community. Discuss the advantages and disadvantages of this new influence on your community. Do you support or oppose the factory? Explain your position.
Building a large factory will bring about both benefits and harmful impacts on my community. In my opinion, advantages of a new factory outweigh disadvantages. Therefore, I definitely support the new factory plan in my community.
As a threshold matter, there will be numerous benefits of constructing a new factory in my community. For instance, the new factory will surely offers considerable opportunities of jobs -- such as cleaners, workers, managers, and so forth, which may ease the pressure of job market. A lot of folks may find their ideal positions in this factory. Besides, tax revenue from the factory will also supplement local government's income. As a result, statesmen would have more money to budget their financial plans. For instance, education system of our community will be the right beneficiary of the factory, because tax revenue from the factory can be spent in ameliorating facilities of community colleges and providing positions with high salary which may enslave quantity of outstanding professors to work in local colleges. Furthermore, the factory will certainly arouse other businesses appear in my community -- for example, hospitals, restaurants, plazas, and so forth, which will boom economy of my community.
Nevertheless, certain disadvantages of constructing a new factory do exist. Especially, some of them may be extremely devastating. Take potential pollution. As a common sense, a factory releases large quantities of wastes, such as polluted water, poisonous gases, and etc, as by-products while it produces merchandises. These wastes may induce towards severe disasters in my community. Polluted water may cause intestinal diseases and stomach cancer; poisonous gases will lead to respiratory diseases which makes quality of life decrease. Moreover, the factory generates loud noises as well, which is especially intolerable during night. Residents' sleep may be disturbed and they do not have enough energy to face daylight work.
When it comes to make a decision about whether to support or oppose the factory, I would like to support the factory plan. There are several reasons to name. Firstly, the factory will bring a excellent opportunity to economy of our community. Local folks will benefit from the plan from the long run time. Secondly, since technology today has developed to a quite high level, I deeply believe that political leaders and managers of the factory will find right ways to solve potential problems caused by the factory. For instance, they may adopt new waste disposing methods to reduce harmful effects of wasted water to the lowest point. Gases will also be carefully cleaned before releasing into the air. Thus, advantages far outweigh disadvantages of the factory.
In summary, there are both benefits and harmful effects that the factory will bring about. In my view, the factory will contribute a lot to our community in future time. Then, it the final analysis, I support the factory plan.
I SUPPORT THE FACTORY PLAN
Building a large factory will bring about both benefits and harmful impacts on my community. In my opinion, advantages of a new factory outweigh disadvantages. Therefore, I definitely support the new factory plan in my community.
As a threshold matter, there will be numerous benefits of constructing a new factory in my community. For instance, the new factory will surely offers considerable opportunities of jobs -- such as cleaners, workers, managers, and so forth, which may ease the pressure of job market. A lot of folks may find their ideal positions in this factory. Besides, tax revenue from the factory will also supplement local government's income. As a result, statesmen would have more money to budget their financial plans. For instance, education system of our community will be the right beneficiary of the factory, because tax revenue from the factory can be spent in ameliorating facilities of community colleges and providing positions with high salary which may enslave quantity of outstanding professors to work in local colleges. Furthermore, the factory will certainly arouse other businesses appear in my community -- for example, hospitals, restaurants, plazas, and so forth, which will boom economy of my community.
Nevertheless, certain disadvantages of constructing a new factory do exist. Especially, some of them may be extremely devastating. Take potential pollution. As a common sense, a factory releases large quantities of wastes, such as polluted water, poisonous gases, and etc, as by-products while it produces merchandises. These wastes may induce towards severe disasters in my community. Polluted water may cause intestinal diseases and stomach cancer; poisonous gases will lead to respiratory diseases which makes quality of life decrease. Moreover, the factory generates loud noises as well, which is especially intolerable during night. Residents' sleep may be disturbed and they do not have enough energy to face daylight work.
When it comes to make a decision about whether to support or oppose the factory, I would like to support the factory plan. There are several reasons to name. Firstly, the factory will bring a excellent opportunity to economy of our community. Local folks will benefit from the plan from the long run time. Secondly, since technology today has developed to a quite high level, I deeply believe that political leaders and managers of the factory will find right ways to solve potential problems caused by the factory. For instance, they may adopt new waste disposing methods to reduce harmful effects of wasted water to the lowest point. Gases will also be carefully cleaned before releasing into the air. Thus, advantages far outweigh disadvantages of the factory.
In summary, there are both benefits and harmful effects that the factory will bring about. In my view, the factory will contribute a lot to our community in future time. Then, it the final analysis, I support the factory plan.
Subscribe to:
Posts (Atom)