景顺's profile予人玫瑰,手留余香PhotosBlogListsMore ![]() | Help |
|
July 30 AutumnJuly 29 半缘修道半缘君本来想拿中文搞点人气,赚赚评论。于是选择了一个最煽情的话题--爱情--生死不渝的爱情。思路是这样的, 第一段,先讲诗 曾经沧海难为水,除却巫山不是云。 第二段,讲个故事 讲一对青年的感情磨难。 第三段,总结,提出观点,遇到相爱的人是缘分,珍惜缘分... 整遍文章构思好了之后,才发现自己操纵中文的能力也不很强。试着写了一会,发现不通顺,很难打动人。于是上网搜索了一下这个诗,却发现了诗背后的故事...
July 23 heap_sort#include <stdio.h>
#include <stdlib.h> #define MAX_ARRAY_SIZE 1000 #define LEFT(X) X *2 #define RIGHT(X) X *2 + 1 void show_array ( int arr[], int begin, int end) { int i ; for (i = begin ; i < end ; i ++) { printf (" %d is %d\n",i,arr[i]); } } void exchange(int arr[] ,int left, int right)
{ int tmp; if (left == right) return; tmp = arr[left]; arr[left] = arr[right]; arr[right] = tmp; } void max_heapify(int arr[], int index, int heap_length)
{ int max,l,r; max = index; l = LEFT(index); r = RIGHT(index); //printf(" l = %d, r= %d,index = %d\n ",l,r,index); if (l < heap_length && arr[l] > arr[index]) max = l; if (r < heap_length && arr[r] > arr[index]) max = r; if (max == index) return; exchange(arr,max,index); max_heapify(arr, max, heap_length); } void build_tree(int arr[], int array_length)
{ int middle,i; middle = array_length/2; if (middle * 2 == array_length) { middle --; } for (i = middle ; i >= 0 ; i --) { max_heapify( arr , i , array_length); } } void heap_sort(int arr[] , int array_length)
{ int heap_length,i; heap_length = array_length; build_tree(arr, array_length); printf("now after build tree\n"); show_array(arr ,0, array_length); for (i = array_length-1 ; i > 0 ; i --) { exchange(arr,i,0); heap_length --; max_heapify(arr,0,heap_length); } } int main(void) { int arr_length ,i; int arr [MAX_ARRAY_SIZE]; arr_length =8; printf("please input %d number\n",arr_length); for (i = 0 ; i < arr_length; i++) scanf("%d\n",arr + i); printf("now the original array is\n"); show_array(arr , 0, arr_length); heap_sort(arr, arr_length); printf("now the sorted array is \n"); show_array(arr, 0, arr_length); return 0; } QuickSort#include <stdio.h>
#include <stdlib.h> #define MAX_LENGTH 100 void show_array(int arr[], int begin, int end)
{ int i ; for (i = begin ; i <end ; i ++) printf("arr[%d] = %d\n",i,arr[i]); } void swith(int arr[], int left,int right)
{ int tmp; if (left == right) return; tmp = arr[left]; arr[left] = arr[right]; arr[right] = tmp; } void quicksort(int arr[], int begin,int end)
{ int i,j,seed; if (end - begin <= 1) return; seed = arr[begin]; i = begin ; j = begin ; while (++j < end) { if (arr[j] < seed) { swith(arr,++i,j); } } swith(arr,i,begin); quicksort(arr,begin,i); quicksort(arr,i+1,end); return; } int main(void) { int arr_length ,i; int arr [MAX_LENGTH]; arr_length = 6; printf("please input %d number\n",arr_length); for (i = 0 ; i < arr_length; i++) scanf("%d\n",arr + i); printf("now the original array is\n"); show_array(arr , 0, arr_length); quicksort(arr, 0, arr_length); printf("now the sorted array is \n"); show_array(arr, 0, arr_length); return 0; } July 22 merge sort/*
When I am a student at college, I have no computer to implement it ...
The first sevral years I began to work, I have no time...
now, here it is.
*/
#include <stdio.h>
#include <stdlib.h> #define MAX 1000 #define ARRAY_SIZE 11 void show(int arr[],int count) { int i; for (i = 0 ; i <count ; i ++) { printf("%d == %d \n",i,arr[i]); } } void merge_sort(int arr[], int begin,int end) { int middle; int temp_array[MAX] ; int i,j,k; if (end-begin == 1) { return; } middle = (begin + end) /2; merge_sort(arr,begin,middle); merge_sort(arr,middle,end); //merge 2 parts together; i = begin; j = middle; k = 0; while(i < middle || j < end) { if (i == middle) { temp_array[k++] = arr[j++]; continue; } if (j == end) { temp_array[k++] = arr[i++]; continue; } if (arr[i] < arr[j]) { temp_array[k++] = arr[i++]; } else { temp_array[k++] = arr[j++]; } } for (k = begin; k < end; k ++) { arr[k] = temp_array[k-begin]; } } int main(void) { int arr[ARRAY_SIZE]; int i ; printf("please input 5 numbers\n"); for (i = 0 ; i < ARRAY_SIZE; i++) { scanf("%d\n",arr + i); } printf("now ,there is origenal array!\n"); show(arr,ARRAY_SIZE); merge_sort(arr,0,ARRAY_SIZE); printf("now ,there is sorted array!\n"); show(arr,ARRAY_SIZE); } July 20 Beijingers told to mind their mannersBy Michael Bristow
Olympics propaganda promotes smiles and displays of unity Beijing citizens have been told not to pick their noses, yawn or scratch their heads when talking to foreigners during the Olympics. They have also been given a list of things not to ask overseas visitors - a list so exhaustive it could make conversation difficult. Ordinary people have also been given detailed instructions on how to talk to disabled people during the Paralympics. Chinese officials want ordinary people to show the country's most civilised face during the sporting events. A booklet prepared by the propaganda department of Beijing's Dongcheng District gives locals an introduction to the games. It has a special section on dealing with foreigners, including what to do when talking to overseas visitors. 'Wear a smile' "In conversation, wear a smile, don't stare too long or do anything to make people feel ill at ease," it says.
It also warns Beijing people not to yawn, shout, pick their noses, scratch their heads, play with their fingernails or pull at their clothes while talking. The booklet suggests people abide by the "eight don't ask" principle when talking to foreigners. Subjects to avoid include what foreigners earn or how much they spend, how old they are, whether they are married and whether they are healthy. Also off-limits are questions about where foreigners live, where they have worked, their religious or political beliefs, or what they are currently doing. In the booklet, propaganda chiefs remind Beijing citizens to be careful when being interviewed by foreign journalists during the Olympics, which begin on 8 August. It tells them not to say or do anything that harms national prestige, the country's image or national security. Queuing day Beijing officials are obviously concerned about how disabled people will be treated during the Paralympics, which takes place just after the Olympics. "Before you help [a disabled person], first of all get their agreement and co-operation. Absolutely do not use force or be too enthusiastic," says the booklet.
Queuing is to be encouraged, say authorities It advises Beijing people to say to disabled people such things as: "You're really excellent". Officials have long been concerned about their own citizens' behaviour during the Olympics, and have launched several campaigns to stamp out bad habits. The 11th day of the month was designated queuing day, instituted to convince people not to barge onto buses and trains. These campaigns are generally supported by ordinary people. "The queuing campaign definitely helps people to behave better," said Yang Xiaoyan as she waited to board a train at Beijing Yonghegong Temple subway station. "In the past it was really chaotic at this subway station," she added. Queuing, crossing the road, driving a car, watching Olympic events and talking to foreigners: Officials want to make sure everyone does it right. July 18 iPodiPod seems not as fancy as other brand of mp3, it have not FM, camera kind of things, and it's price is much expensive than other brands. It's reputation comes from it's elegant design. iPod contributes a lot of conveniences.For example, using ipod to listen audiobook(m4b) is comfortable, ipod can remeber the last positions of each audiobooks. Furthermore, there are very much podcast resources at internet, you can download BBC or CNN news to you ipod. Anyway, the designer of iPod really want give his user some good experiences , instead of provide a lot of useless functions.
July 16 A father and a sonTime goes fast,now, my son is 6 years old.I don't know why, everyone thinks I don't care about him. Maybe when he came, I'm too young to get ready to be a father. Or every time when I think about the relationship between me and him, I recall the relationship between my own father and me.
My father is the type man, who act more and speak little. He be strict to me everytime before I grow up. Although he take all responsibility of being a father, make me eating good, dressing well and getting changces of education, I did not like to go near him very much. I never dear make joke with him. Actually, we did not have much time be together . He always worked late, and I have little time live at home after I went to collage.
Things are diffrent, now, I have a lot of spare time, but I really don't put all my spare time on son. Or I don't like show my loves directly, I don't like praise him all the time, I don't like buy him some candy or sweet food. Sometimes, I bring him to play outdoor, I don't want him just go with me , I try to let him find his own friends. I am a pessimism, I always find his shortcoming. What kind of thing we do can benifit our children? Maybe there is not a standard of being a perfact father, we just do something we can do.
July 12 New week resolutionPerfact whether,blue sky and white cloud.I'm alone at home.
Really depressed, knew the truth, no any chances, feeling fall down.
I don't know why, everytime I'm down for my career , I will remeber Mr. Liu, everytime he will be active infront in everything.
Anyway, I'll keep bing deligence, although I'm doing stupid supporting.
|
|
|