for more info visit http://www.terrorismsearch.blogspot.com/
> The most important civilian killed was Mrs. Benazir Bhutto, former
> Prime Minister.
Until folks manage to work out that there is no such thing as a
"most important" person - that we are all as important as each
other - there will never be peace.
ObProgramming: consider a two-dimensional array named Importance,
NxN elements in size; the array represents the views of a
population N on the importance of people in that population (where
N > 1). Element Importance[X][Y] is an integer value in the range 1
to N, and represents the view of X on the importance of Y, where 1
means "unimportant" and N means "maximally important". Although
there are N values in the range 1 to N in Importance[X][0] through
Importance[X][N-1], there is no requirement that all values must be
distinct within that range. Thus, with N being 5, it would be
permissible for Importance[X] to be { 2, 4, 5, 5, 2 }
Let this array be stored in a text file, with the first line
containing (a text representation of) N, and the next N lines each
containing N (text representations of) array elements.
Alternatively, the array could be generated at random. Your choice.
Write a program that, given such an array, can
(a) determine who is the "most important" person in the group,
according to popular vote (this is easy - to get a person P's
importance rating, add up Importance[0][P] through
Importance[N-1][P]) - and display the entire population in ranking
order, along with their ranking and importance rating;
(b) find "loops" within importance ratings. The simplest example of
a loop is where Person A ranks Person X as being more important
than Person Y, but Person B ranks Person Y as being more important
than Person X. Here is a subset of the array for a slightly more
complicated example where N is at least 4 (if it /is/ 4, each of A
B C D is also one of W X Y Z, but that doesn't really matter here):
Person gives rating for
W X Y Z
A 4 1 2 3
B 1 2 3 4
C 3 4 1 2
D 2 3 4 1
Here, A thinks that W is the most important out of W X Y Z, but B
thinks that Z is more important than W. C thinks X is more
important than Z, and D thinks that Y is more important than X.
Since A thinks that W is more important than Y, we have a loop.
If a loop is detected, we have an inconsistency of views within the
population, so we remove the inconsistency by removing those who
expressed those views. In the example above, A, B, C and D are now
removed from the array. That is, Importance[A][0] through
Importance[A][N - 1] and Importance[0][A] through
Importance[N-1][A] are removed. Same for B, C, and D. (Note that W,
X, Y and Z are not removed, except for any who are also A, B, C, D
- people are not to be held responsible for the views other people
hold of them). This gives you a new N, which is different from the
previous value of N by, say, S. Traverse the entire array,
detecting any values greater than the new N, and subtract S from
those values, to normalise the values given the new array size;
(c) Do this thousands of times with arbitrary data. Classify your
results, and summarise them in this thread. What conclusions can we
draw?
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Forged article? See
http://www.cpax.org.uk/prg/usenet/comp.lang.c/msgauth.php
"Usenet is a strange place" - dmr 29 July 1999