所で、矢張り(対ドル)円安と(米国インフレによる)物価高は半端なく、さほど裕福でもない私には毎日の食事も大変です。例えば贅沢をしなくても現在の美国の都市では$20~30以下で食事をすることは考えられず、州の物品税と(既にIRSに捕捉されている)チップ($15、20、25の選択制が今は一般的)がかかれば、外食するなら朝食から$3~40かかることを覚悟しなければなりません。(これが夕食で、お神酒などを頼んで、しっかり食べると$200~300当たり前、有名店ならOver $500も"Pretty much probable"です。勿論、タックス、チップ前ですよ。まぁ、上を見ればキリがないのですが...)
#include <stdio.h> #include <stdlib.h> /* rand function is defined in this */ #define MAX 1000
int heapsort(int*, int);
int exchg(int, int*, int);
main() {
int data[MAX], i;
/* Initialization of the array */ srand((unsigned int)time(NULL)); /* Use time as a seed */ printf("Initializing data .....\n");
for(i = 0; i < MAX; i++) {
data[i] = rand() % 10000;
} /* Showing Original data */ printf(">>> Original integer data <<<\n");
for(i = 0; i < MAX; i++) {
printf("%6d, ", data[i]);
if((i % 10) == 9)
printf("\n");
}
printf("\n");
heapsort(data, MAX); /* Showing sorted data */ printf(">>> Sorted data <<<\n");
for(i = 0; i < MAX; i++) {
printf("%6d, ", data[i]);
if((i % 10) == 9)
printf("\n");
}
printf("\n");
}
int heapsort(int* data, int n) { /* A heap is a parent-child(ren) relationship as shown below.
Parent(0)
/\
ChildL(1) ChildR(2)
ParentX2+1 ParentX2+2
This may extend to a largeer one.
0
/\
1 2
/\ /\
3 4 5 6
First, each heap will have the biggest as the Parent. When exchanging takes place, do same down forward.
When done, The biggest is stored on the top, then the top and the bottom will be switched.
Then same process continues without the bottom and as a result, the biggest goes to the bottom, the second biggest before it, one by one. */
int top, i;
for(top = n / 2 - 1; top >= 0; top--) /* top is the last parent with two children. */ exchg(top, data, n); /* The biggest in the heap will be the Parent */ for(i = n - 1; i > 0; i--) { /* The biggest will be the last one and the same process continues without the biggest */ int temp;
temp = data[i];
data[i] = data[0];
data[0] = temp;
exchg(0, data, i);
}
}
int exchg(int top, int* data, int n) {
int i, temp;
temp = data[top];
for(i = top * 2 + 1; i < n; top = i, i = top * 2 +1) { /* Identify CildrenL and go on to ground Children as far as any exists */ if(i < n -1 && data[i] < data[i + 1]) /* Select the bigger child, L or R */ i++;
if(temp >= data[i]) /* Compare the Parent and the bigger Child */ break;
data[top] = data[i]; /* The Parent in the heap becomes the biggest */ }
data[top] = temp;
}
とか、
/* Quick Sort */
#include <stdio.h>
#include <stdlib.h> /* rand function is defined in this */ #define MAX 1000
int qcksort(int*, int*);
main() {
int data[MAX], i;
/* Initialization of the array */ srand((unsigned int)time(NULL)); /* Use time as a seed */ printf("Initializing data .....\n");
for(i = 0; i < MAX; i++) {
data[i] = rand() % 10000;
} /* Showing Original data */ printf(">>> Original integer data <<<\n");
for(i = 0; i < MAX; i++) {
printf("%6d, ", data[i]);
if((i % 10) == 9)
printf("\n"); }
printf("\n");
qcksort(data, data + MAX - 1);
/* Showing sorted data */
printf(">>> Sorted data <<<\n");
for(i = 0; i < MAX; i++) {
printf("%6d, ", data[i]);
if((i % 10) == 9)
printf("\n");
}
printf("\n");
}
int qcksort(int* start, int* end) { /* qcksort set a 'key' standard value and find the right position in the array, finally swapping the values of 'key' and the position's.
In this case, key starts from the right end with check from the left end to see if any number greater than key exists. If such number exists, swap takes place.
Then the check starts from the right end to see if any number smaller than key exists and if found, swap also takes place.
Then qcksort calls itself recursively and do same in both the smaller side (left) and the greater side (right) */
if(start < end) {
int *left, *right, key, *kp; /* Key(standard value) may be set in other way */
for(left = start, right = end, key = *right;;) {
while(key >= *left)
left++; /* left ponter proceeds to find a number greater than the standard value */ if(left < right) /* All numbers greater than key to go to right side */ *right = *left; /* If left does not yet reach right, swap the values of right and left */ else { /* No greater value than key exists */ kp = right; /* Key pointer set to right */ break;
}
while(key <= *right)
right--; /* right ponter goes back to find a number smaller than the standard value */ if(left < right) /* All numbers smaller than key to go to left side */ *left = *right; /* If right does not yet come to left, swap the values of right and left */ else { /* No smaller value than key exists */ kp = left;/* Key pointer set to right */ break;
}
}
*kp = key; /* Key value finally finds the position in the array swapping the value of right or left */ qcksort(start, kp - 1); /* Do same for the array of numbers smaller than Key */ qcksort(kp + 1, end);/* Do same for the array of numbers greater than Key */ }
}
USA for AfraicaのWe are the Worldについては参照記事をお読みいただきたいのですが、1985年というのは私が30歳で初めて企業研修で米国本土を踏みしめた年(悲しい哉、この時はまだこの大ヒット曲を知らなかったのですが)、円高・ドル安の進展から日本がバブル経済へと進んだ1985年9月22日のG5(日本、アメリカ、イギリス、ドイツ、フランスの先進5カ国)所謂「プラザ合意」の年であり、後に帰国後教育の一環で通っていた英語クラスの教師とこの曲の歌詞について話したことを覚えています。(勿論、MJが好きだったので歌も覚えました。)
今回私を感慨深くさせたのは
この時代、
世界はもっと単純であり、寛容であり、共感的であり、
手をつなぐことが出来た時代
だったな、という感慨です。この曲や発表過程が現代であれば
「偽善」、
「南北問題ステルス差別」、
「不透明な寄付金使途」、
「もっと自分たちファーストだろう?」
等々もっと批判勢力があり、このようなプロジェクトにはならなかっただろう、という感慨です。
もう、このような無邪気な善意には戻れない
んだろうなという気持ちに満たされました。
ps. 今から40年前の1985年、米国留学中、5番街に「黄金のTrump Tower」を見物にいきました。というのは彼が莫大な損失を出していたこともあったからですが、結局彼はその後も損失を資産として返り咲き、現在に至るわけです。この事実も感慨深いのです。