Algorithm Reading Assignment and Questions by lee92256

VIEWS: 6 PAGES: 4

• pg 1
```									-E
*
&                                                             iwr e                                       .!
geffi?
!t
lll
? r#i                                     ,!   's64                                 'f hl .
tl
al               hffiii:-i                                                                                 @Y'j                                      L:z;d
Fi g                                                                                   trwl                                         \$W
*
n                                                        ?

Fq       rtF                                 FLI                                        TL                                           JFL
=                  ;F                                    fisErF'                                   ittr
.' E
IIFF .
gll'
ffi J 4                                       4               E                                       il

fr-
LX
n*.-,
q
bridBc,  l,rilru-'lhc spi,cdirrrdpl()ccssing
bv                                                                                                                pow crolconrtutc.s' nca1hr 1   n algor ilhm s
crn cxt(ure hsl(s wilh blindiiS sptcd us
i Is vun anrcunts   otdata.
r.c
sonrr of l hcs. l i rsks nior om {ichr
nislic(hanolhoilitr iDslancc,      pcol)k'oi
f4                                                                                                                             ter nrtrkc            w
mrs{ l kcs hcn tlicykcv in t heir
E     c ons udr c r \ at r d c o n ,p u i e s i n c rc a s i n g l y d e p e ndonahi ddormathenrati cal w orl d
uedi r crrd.urnhcr\or1,n c.
ol Itansactionsb.iDs
Wilh r illions
trocesscdalariDre, a
rapi dw ry l ri w ccd ou( i nvr lid nu. r bcr s

I
A t r i( n( llllM s s ,r' Id \!J rv ,,' f ' n rrr!\t                                       take
AlSorirhnrscan many inng Al ils helDslo tce0 processnrg                            rimcsdown. !n.
f1. . r ly        r , l,,rrol rra ,]ti l ,.J l l (,.J         c o r!, an rl gori l hm 1s a stcpbystcp l crthct uhnrl gori thm b clow)!,am cd        Gee
I ic ir n\ .ln iac tr h c y h l v c b fd )D r (h c i n        n rc l hod (l oi nrrj dr. l l )csccanbc l tro ri l er i ts i nvcnl or, arr l uhi, ! n r HMr o
for                                                                H

I
strudnlr manu h fdf a hosr of n,uline s a i r areci poi srnal gori thrnl orprcl ari ng                                   scarchcr.   'rho numbe\$ on a dcdit card
cor)slrnrcr     transrctions.    Browscfora booL a u l l -or theycdr be uD ythi ng                              bur (h. i dcnri l vthc crd tvpc,the issuer nd t hc
r
on Amr^)n.cotrrand algoril|nrs Senc.alc dccjstuntrer poslftstharhaDA hospilai uscr' s                      oD                   accounl    numbef.   TIc lastnum bcr
ns                   k
r c c om m c ndat i o fo r o th e rri rl e s ) b u y - walls and which hclp dodoi\ work oul ol all is scl ro ensurerhar rhc LuhDal8o
ac
B Lr y of y nn. llh e y c i pa l o 8 j s ti clsrm to whal is wnrng wlth a paricnl frcft his ri thmprodu(sal i gurcdi v isible t cn. I i
h                     i                                                                                                            bv
d0cideoD lhe bcst dclivery route.Ringro synrptonrs                            rrecallcdDcd icalalgodthnrs. i( rs.ihc card tru rbor has been propc,ly
t hed(y ou ods f s p ro g re \$ n dm o r0a l Bo
n                            ' l hi sfornul ai cstvl eof (hl nLri ng i t      can   cntcrcdand theproccssingcan ahead.go
r
r ir hm s Dr jn8                   l                th
inlo a c ri o n o d c rc rm i n c e s e l fbe a useful rool for                busi ncsses,    I,uch     Thd Luhnalgorithn pertbrns a simplc
quicke( conrecrionlo and rhrougha call Iikc rhe riSour ol good prcjeclnranage calcularion.                                              [u( the rcal power ol alg]
t
c c nt r e.r om ! nrl y s i n 8 o e d i t c a rdtra n s me n i . B ul comtutcr | ave nrade.i go ri l hnrs                                  w
cnergcs henrheyar e! ul b wor k
aclrons     to.lecrdinghow       losiacft  supennar rilhnrsiar nrore!nluablctocompanies.A oD much more complexprl,bleDs.A! tar
ket shelves,       alBorjrhnl! now underph a compllicr prograrn a lvritlen encoding as most busiresscsare concerned,
is                                                                 lhese
am
l ar ge ount ole v e rv d a y l i l e .                       of an aLgori(hm,"              explainsADdrew Her problenrs            rypicallyhll into lwo typcs:inl.
It'eir pervanlcdessretlcctsthc appli                                                                       in
ben.who runsMic6sofi Rescarch Carn provingearjousprocesses, rs holv att                   such
c.uion oi novcl computnlgpowcr to thc
d8eold complexilies bustncss-No hu
of                               I
nran beinScan worlt iasr enough to pro t ootrythisat home
cessaLl tle data available at a certanr                          lhE Ltrhialgonihm         foryaLrdatligoeditftrdi
scale, saysMilte Lynch.hdss of Auton
omy. a computing llnn that uscs algo                                                                                                                   4 !. 1.6
rnhrnstonakescrseof un\t!ufi DEd dara.                                                                                                        2.!
AlSonlhmscan.As lhc amounl of dataon
everythingfrom        sho!prnshitbnsro media
1.11d                                 ! 4 1 rrs d ; r
':1.         '::
consDlPron,ncreases              ar                                       "9rb!!1p. -     -dMsihL ty ten)
ln*d-      30. (vtrridii
n
c hoos e or epc rs o n a l i s a r' oa l,g o ri rh n s
m
will only bercmemorcimportanr.
TheEconomist       15th 2oo7
S€ptember                                                                                                                BriefingAlqorjth
ms 87

> and sp€€dof an aircraft,           and re ordcrins                                                            supemarketrapjdlyto spotshiftsin rheir
the qucuecan mininris€lhc dclay bcfotc                                                                        consumption      !atlems (caused children
by
aLlth€ planesgel into the air (malhema_                                                                       soing10university,                   s
say).Tesco res!onse
ticians caU rhis lhc dcpallurc problcn).                                                                      raicsto suchtargeted      marLeting    standsat
Air trafic conriollcrs havc always rcor                                                                       1(}2o%,againsl an induslry averageof
deredplanes lhe depa ure queuernan
in
ually,butrcsearcherare            workjngon algo                                                                 Convcrgys!van\$ to bring more rcal-

I
I
rithrnsrhatwould be mole eft cient.
Justasoptimisation
handy whenpeopl€areswampedby vast
numbersof!ermutations,so sialistjcal
gorirhms
rlgorithmscomein

hclp tums to grapplewith com
al
timc daG to rhe operadonof call ccntres.
&rr Gordon gives the exampleol a cus-
tomerwho callsan elcctriciry
an areaihat has sufered a po\'€r failure
and,bcouuse where (h€y are speakiDg
of
utility from

plex datasets.     Dunnhunlby,a dataanaly-                                                                   fron1, aulonratjcJly pui th.ough to an
is
s is t um , us es                    o       d
algo ri th rn s lc ru n c h a tao n                                                         olerator who can deal wrth his qucries.
,]     cusLomcr       behavioul fol a Irumbcr of cli                                                                Suchalgoriihnrshelp fi|ms to ieasc sim
enls.Itsbestknown cuslo,ner             (andmajol                                                            plicity from complexity.
r
ny owner) is T€sco, Bitish supennartct                                                                           Algorithms,rc nor for €veryon€.         some
wrfi a clubcardloyalty.card             schcmcrhar                                                                        wiU
co'npanics alwaysgenerate             moredata
rhun orhcLs, cou6e; retailers,           utilitics
the puirhases of 1tnl mctnbcrs across                                                                        and teleconrs      frrms process   rnany rnorc
55,ooopodud lines.lo ntrke scnscol il lhrd ii nright bc thr an0unt of moDey lGDsrclionsrhatr hoosc i.surers. whose
c        u
a ll.Dunnhum by s n a l y s tso o k e d p a n b c n r g
a                                       spent,l hc ppi ng aj l s
\$hi        del      and the deah tend to happcn once a year.some
I
alSorithncallcdlhc mllnrSbnll.                            tioe of day.aDdso on. Transacti0rs         lhen will ako bc more focusedthan othcrc on
i          ll worksby assigninE
o
nllribuleslo each Sct a fEUd 0(,pcnsi(v scorc based on how algorirhnrs shavccoslsor maxi
r
ol t he pr oduc ls n ' i c s c o s h c l v e s . h c s c th e s € churacl cri ni csi
T
rans - "f r or er s y l o c (l * 1 0 v a l u cfo r        which sco.cs
merchants
can
dcci dc misc caprcily.Irinnslhal enjoy hjgh mar
should ting alarn bclls and si ns tnd ni {)ngdc,nand e goiDg bc    ar           10
l                                          s
m o. c y ,f r om advc n l u rl ' u1 oi e s h . l n o .
r                    (l
d c rlo giv e at ing s i o rc v c rvi mc n s i o o fu
n                        rru
Al B ori (hnrs rnost    commonl y
l ess ofti cduboull he enicicncy t hcil
w
associ . supfi v drri ns,saysIl au Le e, Slanf or d
ol
ol

product, rolling.b ll .rlBolilhm nalts a( a tc d wj l h i nl cncl -scarch
thc            r                                                            cngi nes. The (nadur(e chool B usi ncss.
"                  S          of
(l' c c x lr em es : o s ri clh r8 c Ns a y ,w o u l d l u s s l e
)u         ,                       bcLw ccn  MsN , (,oogl e andY ahool i s
counlasv er yadv c n l u ()u sl.h c a l g o ri th n r ,b o u l w hoscal sori th produces best Rocltot
thc                 scicncofor non-bofEns
th.n trawls lhrough lcsds purchasing rcsullslo a qu0rv, obscrvesN,licrosoft\ w hrt i sN ' r0,l ol sol l hi ngs have)t ullink)                       t(
data to sce what other froducts (staplcs M r tl c rb.rt-A sk.conr,                 anothcr   search    {rn plac f{tr rltorilhnrs ki work.Thcy teDdk)
s uc has ilk andb rc a d a s i d o )rc n dw i n d gi.c,has cvcnlricd k) popularise lern
m                                to                                                  lhc          be haghlyconrplcEit is not casy b find
ba                       h
u p iDr hes anr . s h o p p i n g s k c ts a s o s tri c h a. adv{rlisarg cal|rpaign.lrw othcr pcopl cw i th hcr,ghlski l l sl o dcvck, p
l                             and
burge6do.Products           that cnronglyasso. lypcs of cotrrpanics so obviously dc
ard                         rcnnrl hcm.l hcsysl cmswilhin         whicht hc
cialrd will scorc,norc highly on thc ad                    pcndrnl on algorithms    t(trsucccss,bur     rhe al8orithDrs     run-lhc uscr inlerfacc necd
v.nlurdusnelsscalc.As \$c associrrioDs rolc thal they play is risnr{ in importancr to bc i nl ui ti vc to non bom ns. Tbis is
bc(wcen prcductsbe(nnc pogrcssively                                                                           roclel scictrcc you don't baveto bc a
bul
r
wealicon onedi me n s i o n , c ys l a r1 1Bc l
th             o         The lirn is drc rJ)ecrarnouorof dara rockel cnti sl l rs. i 1,' !dysJad(Noo
sci           1o
siron80.on another.Thc brll has rolicd th a ti s                                  c
now avai l ablto compani es.Thc nrn, bossol srss. l he i npur ! havelo bc
in
from o.e anribu(c(o unorher.              With cvery tormatior floodwrlers arc rising every ri ghl .One ur,spl anni ng delr ouledall        mo
produd catesoriscd gradcdacros ev where.Sma m clcrsgivc utilil y Iirmsdala rhe pad(agcs lhc svsiemthroughlowa,
and                                          11                                                     in
ery lribLlte,      Dunnhumby is able lo scg on consumplionpattcrns inside house- whjch pcrd€xcd cvcryone until thcy
customc6bascd h o l d s. i gi tal      mcdi r w i l l makci t casi er for i bundan ci i or i n l hedatal hat m adejt      ap.
lirms slrch as Dunnhumby to sec how pearto bc ftc01o                                      via
scndpac kages lowa.
wha( people read online and warch on Thc algorithm was right,in orher words,
wherelo pur the biscuir\$                                  television aileclswhat theybuy-                    b!l lhe datawercw'ong. MrNoonan says
Thc rulling ball algorilhm is jn rts lourth                   Online shoppingueans lhar inlemer that spsss"sccrelsrDce"ljcs in ac abjlity
veaion. Rehnements            occurcvcry ycar or merchanls            now know wha                                                       or
lo dcal wilh trrissiDg urreliable dala.
or                                                       search en       mtherlhan thc algorithms        themselvps-
maths-Al1rlese dararhcn fc,cdinto a va- gines miningt hcir own into.mationon
arc                                              Aboveall. humanjudSmenrstill has a
rietyof dccisions,such rhc langcsloput the relationship belween qucries and rolc a poinl perhapsrcinfo(ed by the re
as
into eachstore which products
so                                 ceDtperfonnanceof algorithmicallydri
sit next to cachoth€r on the shelves.'All jng aigorjlhms.'[or the first time i. bu!i                         ven quanlilalive funds in the ijnancial
this sophisdcared         data analysis and jt ness hislory there is more information nlarl(ets. ftaud detection, dample,
ln                      for
comesdown ro whcrc you pul the bis' than many organisaiions                             capaciiyio deal alg{trithms        can eljminaieihe majonly of
cuiis,"lamcntsMart]n H.1yward,              dircdor wjth it," saysDu n nhumby'sMr I-Iay             ward. tran sa   ctions  ihat areabove    suspicion a  but
of consDcrstratcgyar Dunnhumby.                           Aleorilhmsarca way lo cope.                       human ls still besi placcdlo aDalyse           the
Fraud    d€lection a touchmoie glam-
has                                  Thc s€cond   reason  why algoithms are dod8yoncs.Dunnhumbyistiyingto over-
our lo it. sFssianotherdata-analysis            nrft, becoming       more importanris lhal compa. lay aniiudinalrcscarch                  oniop ofpurchas
uses aLgorithnrs scrutinis€ customcr nies inevibbly wanr io use all this new in8 dala lo undcrslandwhy people buy
to
data and 1o build propensityscores                rhat datato do morccomplicarcd          lhings. pal
ln       thingsas wcll as wbar lhey buy. [ven so,
predicthowpeoplcwill behave.               Oneof its nqhr, they want to respondto eachcus AuronomyS Lynch onvinced that al  Mr          is
clien\$is Clearcomnerce,            which provides tomer in a personalkedway. Tesco                   does gorjthns arc on rhe march. Algorirhns
payment?rocessjnS             services to oiline this by using its analysisto tailor dircci prccess                    data lo arrive at an an\$ver. The
merchanrs.       spss helped Clearcommerce marketingofers to cach Clubcardnem                               moredrta lhey canprocess more accuthe
krbuildasys{emlhar           looksata cusloher's ber. As well as segmeniing customen rale the answer.For thai reason. says,
us                                                          he
pan transactions Iearnsand            what hinls at onho!'lhcy ljv€,th€ dataalsoenablethe ' thevareboundl otate                          overt hewodd. I
I
, nctwork is configured and asupply chain                       l i neC rocershav€huge   fe€dba& l oops" i n    not talk to ihe no\r conirol alSornhm,
is nrn, or dalysinS dataon thingssuchas                      which \$e delivery times chosenby os              which mcans paths do not changeeven
tomers affecl tbe rcutes thal van5 take,        when lhere is congestion.     Accordingto
ups usesalgorithms hclp deliverlhe
to                                                    ih€
whnhin tutn aflects choice d€livery
of             t\4arcWennlnk,a researcherat    B!itainjs!r,
miLlions packages
to            ups is     combining the alSornhmswould Incan
most ellicientway possible.          the simplest              drivers  thal caDrecalibrate orderofde.
ibe                becom€much more rcsilientto nctivork
roures easyto draw up. lfa drjter hrs
are                                                             on
li!,eries lhc fly, in much the sameway          disruplion.It would alsoallow Br lo make
only tbreedeslinations visit,hecanlake
only s ix p o s s i bro u te s .B u l l h c n mb € rof
le                                       just rhcnselv€sif a driver chooses ,g to           Airponsaho havea k€en inlereslin dy
possibierout€s cxplodcsas the deslina                         noreasuggesi€droute.                            namic algorithnx.fass€ngers l-ondons
at
tionsincrease.Thcrc morc tban 15Uii
are                                       1nihc world of lhc intcrnet,operaiors     Ileathrowandolhercongested       airporlsof-
lion, ldlLion possibleroutcs to tal(c on a                    arelookingat waysofmaffying up ihe al.          Qn sit jn a lons queueof planeswdiliig
journey withjust 25drop of points-and                         gorithms llat lind the shonest palh             ncarthenrnwaylo depart.     D€layshtupen
an av€6gcdayfora ur s driverjn America                        througha nelwork and thoscthat control          bccause  airlrafiic contrcllelsneedro lcave
involves15o destinations.         The pi€ruie is              lhe spcedwrih which informationfloivs.          a satcly margD bclween aarcmft lhey as
fulther colnplicarcd consiraints
by                  suchas           At rhemoment,therouiingalSorithm      does      lake otr. This nurgin dcpendson the sizc |l
specifi€ddrop otr and pick u! iimes for
drjvers or runway lcnglhs and noise rc                         B l gsum5
strictions ajrcrali- Algorithmsplovidc
for
bcnclilswhenthe drcjccsaresogrcrl rh|l
thcy arc impossiblcto processin yot.
Of greedand ants
L
hoad, ' s a yu rs s J a c [ e v i s .
s
Nature could help designcven smaner algorirhms
Solving this 'lft]vcllingsalesman pi{)                        r\l   A LLrhepl e-sJ,c\ ' red rhc
utti   by                (rl gc.rneal gori ,hnwour d r h". cxr
pur
rJ                   o
blc m " mc a na l o 1 1 () r,s .l b rrl s te e lfri r
s                                         \-,, alponthmi" solld.thc colourtul             masrwhererr covers   rhemaxrmum
crliil in America. ()ftpany uscsrn al
the                                   namcs usinhabnanls prelty
oI          rank                           rmountof uncovered
space.
Sdrilhmcalled voLc^No (which slands                           highly.Bubblesortis a sortingalgorilhn        Greedyalgo.ithms      can be very effcc-
fttr Volumc,                  and
Location Aircraf(Nclwork                                  i
l hal sw aps(cms n al i s(i f theydren
i                  l                 are
ti ve.They us€dinnelwor k ouung o  r      t
O plinr is e r). c v e l ,)p c j o i n tl y w i l h { h c
D                d                          (hew roncorder.crrbl i nprm.rl l €r,tem! fi nd rhcshorresr o r sible h o r dcs
D         Dar t
N, hs s ac h u s e tts ti l u tc o l T c c h n o k )g y
lns                                    to buobl c thei op.the bLl l yr.l E onrhr ri nfl i on.for.xoniple. our 'gr ecdr l'n
Io
( M n) ,it 1 !!s c d b y th r* d i fl c rc np l u n n i n g
t                \el ccFa l .,d comprrcr n drsr,.bured
i                makr: rhem\horrr ghr cd.      <JysE'ik   Dc-
S nnr ps n h i n u rs .-o n e op l a ns c h c d u l cs
w                       1                          compu I proces:es.
rin           tvcn aIgonlh m r    majne.a compurcr-(cjen pmfes,orI
ce
lbr lheio i l o w n r[ o u rk ,s i xmo n l h s ,o n e l o
i                                     namedaftertheirparents amu\$ecan           Mrr. creedyalgorithms       makebad chcss-
wo orr what kitrd of faciliticsand air                        Blum Blumshub may sound like the title players, uample, laling an oppo-
lor
b               o
c r af t nr ig h ten c c d e d v c rth en e x tl w o k )       oIa Motown recod bur is actuallythe       nenfs pawn foi an immediatebut slighl
()tl
lc t ry c ar s ,a n d o n c a n f,rrl h cp c d k s l a        namcofl numbergen" mrngD l gori ,hm.advanrage rti r m eans
evcn            losind r
\$nr bc t w c c nT h a n k s g i v i na .d (i h ri s l
g                        C rcedy B ori rhm\
al        rekca.hoo'i rorn quccr asa reruh.
m 0s . ( ; c1 1 i nlgrc s u h c d u l i n g rc n g i m
l                    w                   dre-hrp  approach,makmgrhc ce   choi          I' orrhcqamcrc D, on               .
al8or ir hmJr c
f os c s a h e a v y c o s l : l l y i n g h a l fc mp l y     rhdlgi vcl rhcbesl posebl coul (omear norvFrvgoodal co p'newir hf ssi. chr ns-
Dlanesor      Ieasin8cxlra                is
arrcrafi an expcn             any particula.momentTo solvethe           ing environments,    su€has tmnsportnet
urs
sivcbusiness. red(oDs voL(i^No        thar                     travelling-salesmar problem. a Br€edy     works thal are prone to disruption. But
has s av eth cc o m ttrn y rs o fmi l l i o n s t
d                   re                  o       algorithmwould simplylnstructa ddver they ar€Setting             r.
ben€ Themassof data
its
dollarssince introduction 2ooo,         in                     rogoro,hereare{unvi si rcddesri na        combi nedw i rh(h epower ol. om pur er \
l-o8istics   lirms lrc lar from thc only                 ,i on. dcci de hof ro E l acc
To        w               mobrl e                                ur
now rnake' j rD o\\ iolcr\o Dass     hum dn
oncs worklnS on optjnrisalion" ulgo                            phonemastsforthew i d;si possi bl ecrj v-expertsi asoni e f r elds, sayst inayr cs, a
r ilhnt . T e l e c o n rs o !c ra l o n u sl e o ri rh ms
a g                     '                                     professor YaleUniversity, a new
at                 in
to cstablishthe quickc( connections                   for                                                book,"Sup€rCrunchers"       (seepa8c1o3).
phone callslhtuugh lheir Derworlsor ro                                                                       Tbo{sten Schnier,a Esearcher at
rctriev€web pagcsspeedilyliom the in                                                                     C€rcia, otrshoot lle compuiersci- l
an         of
lerncl. Manufaclurcrsand retailersusc                                                                    cncedepdr     tmentat BriErn s Univ€rsitv
l                          .
t hemt oll n e tu n e h c i rs u p l l y c h a i n sc a l l                                              of Birmingham,    bclieves  that alsortih;s
ccntresdecid€        whcre1oplacean incoming                                                             basedon biological    iystemdoffergreat ,
call, based o.                     such as lhe cus                                                       potential.Anis, instance,
for            dropphero' -
lomeis location,lhe     'hin8slengthofqueu€s(hal                                                         mones6 they search food to bring
for
opcralors     havelo dealwith and thereason                                                              back to the colony. Oiher mls follow
ihesetrails andconveryc thosewh€re
on
Jetr cordon, who looks aftcr innova                                                                                                   (they
pheromones fie stronsesi are, .l
are
tjon fo! Convergys, call centreo!eratori
a
saysthatthe efficjcncy algorithms as
of             is
6;ffi;il;"-rd";;,i;;;;;ili'
these DdnciDlesan be mim-
routes).             c
cruciallohis indusry asthe q'ralityofcall                                                                      icked in antcojony aieorlrlDrs that send '
agenb: If you get lhe algoridun wrong                                                                          virhral alls hto a simulated network,     :
and pur cuslomer!into rhe wrone hands                                                        Kt'gj*l           €ndonly ar first bur thcn with instruc
ihe            No                                                               MIB                      to                     pher om one
ri ons l bl l ow ' hest r onee\ .
beint handedoffto someoneetse."                                                              lTimifi!3df       rail. l]iitis blockedbv sone kind of dis" ,
Th€ most powerfuL algorithms are                                                          Sl       *i       rupr,on. ol dnai li, r e' up, nc r he
ihose that cop€ with continual changes                                                       nl f,                         ' he
antsrcurrv,ol hen€xt beslr oLt e.
l       {seebo . The detiveryschedules on for                                                           -.rl\
i
I

1. What is the title of this article and which magazine (including the issue) did it
come from?

2. List three industries that use algorithms.

3. Use the Luhn algorithm on one of your parent’s (or your own) credit cards.
Don’t list the original number, but what was the answer and was it divisible by
10?

4. What is the name of the algorithm that UPS uses? What does it stand for?

5. What is Bubble sort?

6. On the last page, the article says of algorithms “…the role that they play is
rising in importance for two reasons.” What are those two reasons?

7. In your own words, what is an algorithm?

```
To top