Real Life
15, .4s Kim knew from her Englistscourses, palindromes afe phrases that vead the same way tight
to-left as they do left-to-right, when disregarding capitalization. The problema title, she
recalled, was attributed (o Napoleon, who was exiled and died on the istand of Elba. Beang the
mathematically minded type, Kim Ukened that to her hobby of looking fer patinueo mes on her
vehicle odometer. 245542 {her ald car), oF 002200 (her new car)
‘Now; in her first job after completing her undergradwate program in Computer Serence,
Kim is once again working with palindromes, As part of her work. she is exploring alternative
secunty encoding algorithms based on the premise shat the encoding strings are NOT palin-
romes, Her ftst task is wo examine a large set of strings to identify those that are palindromes,
so they may be deleted From the list of potential encoding strings.
“The strings comet of lenters, (a. 2.4... Zh anal mumbers, (0 .. 99 Kirn has one-
dirvessional array of porters, ey 24 se | | in which each element posuts to the start of a string
‘As selth all character strings, he sequence of chars termanates. with dhe Aull character, "0"
Kim's program is co examme each string add print ot all strmng numbers (the subscripts ef
aylist [| identifying the swings) that correspond to palimdrcnes, “
3-16, Andy, Tom, Bill, and Fred have spent most of thear freshman year playing a simple card game.
‘They deal ont deck of 52 regulac playing cards, 13 vo each person. The rules are similar €o
Bridge or Spades: teams of two players, seated s¢ that each player has a member of the other
earn co his left and tight, AU 52 cards are dealt one ata time in aclockwise manner The dealer
Yeads first, players rake turns playing in @ clockwise manner, nd must follow suut if possible;
the highest card played of the wit led wins the four-card trick unless a “tramp” is played. in
swhich case the highest uump wins. Dealer passes (9 the left altcr each hand of 13 tneks has
been played, The object is to win the most tricks for yout team. Trump is determined by the
player who beds the most tricks: [¢., who calls out the highest number of ticks Re or she thinks
his or her team can win, Bidding slarts with dealer and moves clockwise until four consecutrvt
players have announced “no further bid.” Bach successive bid must be at east ane higher than
its predecessor. IF no one makes 8 bid, the dealer is stuck with a minimum bid of seven.
Lately, however, one of their group has taken 4 retiewred imevest in studying. The result
ws that Fewer than four players are available to play some evenings Tiwi decided to write a
small game-playimg program 10 fil infor the missing player. Pred wants we make i a pallet
computing implementation o allove for the possibility that more man one may be missing. Your
job is to- assist Fred, i
317. A small company is having difBouity keeping up with demand for ts services: retrieval of dats
from a huge database. The company used to just hand « clerk the fist of items to be retrieved.
and he of she sould manually look chrough the-fles t find them, The company has progressed
far beyond that: now it hands ¢ peogram a hist of items, and che program tooks through (he
database and finds them. Latcly the list of itenss has grow so large, and the retrieve! proce-s
has become so titit-consuming, that customers have begun (0 complain. The company has
offered you the job of reimplementing its retrieval process by using multiple machines in
paralle! and dividing up the list of tems to be retrieved among the machines
Part 1; Identify all the pitfalls or roadblocks facing you in moving the retrieval process 10
a parallel processing implementation chat are not present in the existing serialisingle
processor one.
Part 2; entity one or more solutions to each item identified in Part 1.
Part 3: Simulate a composite solution, retrieving (from a large dutubaxe) all the items vt a
list, using multipte processors working m parallel,
404 Embarrassingly Parallel Computations Chap. 3‘348, Over the past 35 years a éeries of unmanned radar-mpapping shissions have produced a very
detailed topographic map of the moan's surface, This information has been digitized and is
available. in a gridlike format known as a Mercator projection. The topographical data for the
next unnnanned lending area is contained in a 100% 100 array of grid points denoting the height
above tor belt) the average moon surface level for that 10 kra x 1 km region. This particular
landing region was chosen for its gradually changing topography. you may ascume that
linearly interpolating between any ru adjacent grid-points will accurately describe the
landscape bewween those gnd. points.
Upon the rocket landing sorewhere within the designated 10 kan x IG kmegton. it will
discharge a number of autonomous robots, They will conduct a detailed exploration of the
region and report their cesults back to the rocket via a line-of-sight lightwave communications
link (lashes of light emitted by the robots and detected by the rocket). Once its exploration is
complete, itis essential chat a robo be able to find quickly Lhe nearest location from which line
of-stght communication can occur, since at wall have only a short battery life
‘The rocket designers have assured us chat their receiving entenna will be 20 m abave the
site the lanuling: the transmitting antenna ¢e the robot will be 1m above its site, wherever
hat maay be inthe region Thus, given oaly the 100 10D array and the geid-point locations of
Ue rocket and a robow, your job is te determine the grid point nearest the robat that witl permit
line-of-sight communication with the rocket. You may assurte that the topographical data arcay
comtains only heights in imeger valves between +100 m and —100 m, and that both the rocket
and (he-robots will be lecaled on gid points when accessing your program. :
3419. You are given a array of 100 x 10000 floating point values representing data collected ms
series of "hake-offs" making up the final exarn at the Nella Schoo! for the Culinary Arts. AS
with all grading systems, this data must be massaged (normalized) prior w actually assigning
grades. For each of the 100 students (whose data is ie a row of 10,000 values), the following
operations must be performed
INS (initial normalized scove)
“The average of the squares of oll data values irva given row that are greater than zero but
Jess than 10G_
ENS (Final aormalized sxre)
The value computed for this student's INS, compared to all other students’ INS scores.
The students whose INS scores are in the top 10% overall get am FNS of 4.0; those in
the next 20% get an FMS of 3.0; those in the next 36% get an FNS of 2.0: those in the
raent 20% get an FNS of 1.0: the rest get an FNS of 0 0 and have to enter the “bake-off*
again next year as a result,
‘Your program is to print out the FINS scores (wa ways;
1. Alist ef FNS scores, by student (row number. FNS) for all students
A list of smudems, by FNS (FINS, list of all rows [students] with this FNS) for all FNS
values “1
Recently, there hax been soniewhat of a public health scare related to the presence of a baci:
‘ium, eryptosporidium. in the water supply system of several municipalities. fr hascarne to our
attention that band of literary terrorists is spreading that bacterium by cleverly and secretly
‘embedding it in novels. You have been hired by a major publishing company to search a new
novel far the presence of the wotd erypresporigium. Its known that the terrorists have resorted
fo msertion of punctuation, capitalization, and spacing to disguise the presence of cryprospo:
radian filing stances: of the Word requares more than-doing a simple word search of thevext
320,
Chap. 3 Problems 105106
For example, ia a highly publicized case. one page ended with she sentence
“Leaving his faithfol companion, Ospor. guard the hallway, Tew Ste slowly down
the stairs and entered the darkened érypt”
while the nest page began with
“spor, { dium, HELPT cried Tom, a the grant bats Be had disturbed Mew around bis head
Diseaver wae narrowly avenied when a clerk [wokily caught what Re thought was a typo and
changed “I dium" 49 “l'm dying” jst 35 the Book wen 10 press: Sunce this particular publisher
andves many books. iLs essental that cach one he scanned as Quickly 45 possible, To accom-
plish this you have proposed sowse many computers In parallel co divide the task mnto smaller
chunks; each computer would scarch only 3 portion ofa text If successful, you stand tg make
sizeable commission from the vale of networked computers te the publisher.
“Alerative approaches are as follows!
1. Divide the text ante equal size sections lund agsign each sctilon to a single pricessur
Bach processor checks ats seetion and passes information (about whether it found
creprasporidiwn in its section. potential portions of (he bacterium as Ue first oF Tast
partons of is seciion, «#9 evidence of the bacterium a all) back (9.2 master. whch
arernines what Was passed Deck 10 i apd repos on HE BOOK 2» 8 whole
2 Divide the text inte many More small sections than thect are proyessurs and ust a Work
poo! approach, in which faster processors effectively do more of the total work, bur in
pecentatly Ue saqne manner as Geseribed in the precediog approach.
Embarassingly Parallel Computations Chap. 3