An Introduction to Computer Science and Problem Solving




Loading...







Computer Science and Game Theory: A Brief Survey

(see, for example, [Kearns and Reiter 2005; Sandholm and Yakoo 2003]); leading computer scientists are often invited to speak at major game theory conferences, such as the World Congress on Game Theory 2000 and 2004 In this article I survey some of the main themes of work in the area, with a focus on the work in computer science

An Introduction to Computer Science and Problem Solving

Many important topics in computer science can be taught without using computers at all This book unplugs computer science by providing twenty off-line activities, games and puzzles that are suitable for people of all ages and backgrounds, but especially for elementary school chil-dren

Computer Science - Computer Games September Entry

Computer Science - Computer Games Co-op Entry Year Term Course Title Credit Prerequisite Co-requisite Year 1 Fall COMP 232 Mathematics for Computer Science 3 00 MATH 203, 204 COMP 248 Object-Oriented Programming I 3 50 MATH 204 Elective* Winter COMP 228 System Hardware 3 00 COMP 248 MATH 203, 204

Designing educational games for computer programming: A

example, computer programming is a vital knowledge area within computer science with constantly changing curriculum and its teaching remains a difficult endeavour On the other hand, students start from a very early age to interact with computers through games and other entertaining multimedia software

Computer Science - Brown University

the nation's leading computer science programs, the Computer Science Department has continuously produced prominent contributors in the field Computer Science combines the intellectual challenge of a new discipline with the excitement of an innovative and rapidly expanding technology

Searches related to computer science and games filetype:pdf

However, computer science is not an area of study that pertains to IT support, repairing computers, nor installing and configuring networks Nor does it have anything to do with simply using a computer such as doing word-processing, browsing the web or playing games The focus of computer science is on understanding what goes on behind the

An Introduction to Computer Science and Problem Solving 60351_3bell98a.pdf

ComputerScienceUnplugged...

off-lineactivitiesandgames forallages

TimBell

IanH.Witten

MikeFellows

c

June9,1998

Thisversionofthebookmayonlybeusedbythosewhohavepurchasedashareware licence.Ifyouhaveanindividuallicenceyoumayprintonecopyofthisbookfor yourownuse,orifaninstitutionallicencehasbeenpurchased,acopymaybeprinted foranystaffmemberoftheinstitution,foruseintheinstitution.Copiesoftheblack- linemastersmaybemadeforyourownusewithclasses.Otherwisethisbookmay notbecopiedordistributedwithoutpermission.Seethewebsitebelowfordetails aboutobtainingalicence.Copyright1998.Allrightsreserved. http://unplugged.canterbury.ac.nz

Authors'contactdetails:

TimBell,

DepartmentofComputerScience,

UniversityofCanterbury,

PrivateBag4800,

Christchurch,NewZealand

tim@cosc.canterbury.ac.nz, phone(+643)364-2352

IanH.Witten,

DepartmentofComputerScience,

WaikatoUniversity,

Hamilton,NewZealand

ihw@waikato.ac.nz, phone(+647)838-4246

MikeFellows,

DepartmentofComputerScience,

UniversityofVictoria,

Victoria,BC,CanadaV8W3P6

mfellows@csr.UVic.ca, phone(604)721-2399

Aboutthisbook

Manyimportanttopicsincomputersciencecanbetaughtwithoutusingcomputersatall.This bookunplugscomputersciencebyprovidingtwentyoff-lineactivities,gamesandpuzzlesthat aresuitableforpeopleofallagesandbackgrounds,butespeciallyforelementaryschoolchil- dren.Theactivitiescoverawiderangeoftopics,fromalgorithmstoartificialintelligence,from binarynumberstobooleancircuits,compressiontocryptography,datarepresentationtodead- lock.Byavoidingtheuseofcomputersaltogether,theactivitiesappealtothosewholackready accesstocomputers,andareidealforpeoplewhodon'tfeelcomfortableusingthem.Theonly materialsneededarecards,string,crayonsandotherhouseholditems. Fullinstructionsaregivenforeachactivity,andreproduciblesareprovidedwhereverpos- sibletominimizetheeffortrequiredforclasspreparation.Eachactivityincludesabackground sectionthatexplainsitssignificance,andanswersareprovidedforallproblems.Allyouneed formostoftheseactivitiesarecuriosityandenthusiasm. Theseactivitiesareprimarilyaimedatthefivetotwelveyear-oldagegroup.Theyhavebeen usedintheclassroom,insciencecenterdemonstrations,inthehome,andevenforcommunity fundaysinapark!Buttheyarebynomeansrestrictedtothisagerange:theyhavebeenused toteacholderchildrenandadultstoo. Thisbookisprincipallyforteacherswhowouldliketogivetheirclassessomethingabit differentfromthestandardfare,teachersattheelementary,juniorhigh,andhighschoollevels. Itisalsowrittenforcomputingprofessionalswhowouldliketohelpoutintheirchildren's orgrandchildren'sclassrooms,forparentswhocanusetheseasfamilyactivities,forhome- schoolers,forsciencecenterswhoruneducationalprogramsforchildren,forcomputercamps orclubs,andforcourseinstructors-includinguniversityprofessors-whoarelookingfora motivationalintroductiontoacomputersciencetopic.Itisdesignedforanyonewhowants tointroducepeopletokeyconceptsoftheinformationageofwhichtheyhavenoknowledge themselves. TopicsincludethePoorCartographer(graphcoloring),theMuddyCity(minimalspanning trees),TreasureHunt(finite-statemachines),thePeruvianCoinFlip(cryptographicprotocols), MagicCardFlips(errorcorrectingcodes),theChocolateFactory(human-computerinterac- tion),andmanymore. Sounplugyourcomputer,andgetreadytolearnwhatcomputerscienceisreallyabout!

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Pagei

Pageii

Acknowledgments

Manychildrenandteachershavehelpedustore®neourideas.Thechildrenandteachersat SouthParkSchool(Victoria,BC),ShirleyPrimarySchool,andIlamPrimarySchool(Christchurch, NewZealand)wereguineapigsformanyactivities.WeareparticularlygratefultoLindaPic- ciotto,KarenAble,BryonPorteous,PaulCathro,TracyHarrold,SimoneTanoa,LorraineWood- ®eld,andLynnAtkinsonforwelcomingusintotheirclassroomsandmakinghelpfulsugges- tionsforre®nementstotheactivities.GwendaBensemannhastrialedseveraloftheactivities forusandsuggestedmodi®cations.RichardLyndersandSumantMurugeshhavehelpedwith classroomtrials.PartsofthecryptographyactivitiesweredevelopedbyKenNoblitz.Some oftheactivitieswererunundertheumbrellaoftheVictoria"Mathmania"group,withhelp fromKathyBeveridge.ThedelightfulillustrationsweredonebyMalcolmRobinsonandGail Williams,andhavealsobene®tedfromadvicefromHansKnutson.MattPowellhasprovided valuableassistancewiththe"Unplugged"project. SpecialthanksgotoPaulandRuthEllenHoward,whotestedmanyoftheactivitiesand providedanumberofhelpfulsuggestions.PeterHenderson,JoanMitchell,NancyWalker- Mitchell,JaneMcKenzie,GwenStark,TonySmith,TimA.H.Bell1,MikeHallett,andHarold

Thimblebyalsoprovidednumeroushelpfulcomments.

Weoweahugedebttoourfamilies:Judith,Pam,andRobertafortheirsupport,andAndrew, Anna,Hannah,Max,Michael,andNikkiwhoinspiredmuchofthiswork,2andwereoftenthe

®rstchildrentotestanactivity.

Wewelcomecommentsandsuggestionsabouttheactivities.Detailsaboutcontactingthe authorsaregivenonpage227intheconclusion.

1Norelationtothe®rstauthor.

2Infact,thetextcompressionactivitywasinventedbyMichael.

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Pageiii

Pageiv

Contents

Introduction1

IData:therawmaterial-Representinginformation7

1Countthedots-Binarynumbers11

2Colorbynumbers-Imagerepresentation19

3Youcansaythatagain!-Textcompression27

4Cardflipmagic-Errordetectionandcorrection33

5Twentyguesses-Informationtheory41

IIPuttingcomputerstowork-Algorithms49

6Battleships-Searchingalgorithms55

7Lightestandheaviest-Sortingalgorithms73

8Beattheclock-Sortingnetworks83

9Themuddycity-Minimalspanningtrees91

10Theorangegame-Routinganddeadlockinnetworks97

IIITellingcomputerswhattodo-Representingprocedures103

11Treasurehunt-Finite-stateautomata107

12Marchingorders-Programminglanguages119

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Pagev

IVReallyhardproblemsÐIntractability125

13ThepoorcartographerÐGraphcoloring129

14TouristtownÐDominatingsets143

15IceroadsÐSteinertrees151

VSharingsecretsandfightingcrimeÐCryptography163

16SharingsecretsÐInformationhidingprotocols169

17ThePeruviancoinflipÐCryptographicprotocols173

18KidkryptoÐPublic-keyencryption185

VIThehumanfaceofcomputingÐInteractingwithcomputers195

19ThechocolatefactoryÐHumaninterfacedesign199

20ConversationswithcomputersÐTheTuringtest213

Conclusion227

Bibliography229

References229

Index231

Pagevi

Introduction

Computersareeverywhere.Thoughyoumaynotrealizeit,it'sunlikelythatyou'llgetthrough thedaywithoutusingone.Evenifyoudon'thaveoneathome,andyoudon'tuseabank,and youavoidthecheckoutatthesupermarketÐandthecornerstoreÐyou'llprobablyendupusing acomputerdisguisedasaVCR,microwave,orvideogame.Whenyougraduatefromschool, itwillbehardto®ndacareerthatdoesn'tinvolvecomputers.Theyseemtobetakingover! Withcomputersaroundeverycorner,itmakessenseto®ndouthowtheywork,whattheycan doÐandwhattheycan'tdo.Theactivitiesinthisbookwillgiveyouadeeperunderstandingof whatcomputersareabout. Thereasonthisbookisªunpluggedºisthatweareconcernedaboutpresentingtheideas andissuesofcomputerscience,andtheseareofteneasiertoexplainwithpaperandcrayons, ordinarymaterials,andsimpleactivities.Webelieveyouwillbesurprisedanddelighted,as weare,withhowmuchentertainmentcanbehadwithsimplethingsanimatedbytheideas importantinunderstandingcomputers.RatherthantalkingaboutchipsanddisksandROMand RAM,wewanttoconveyafeelingfortherealbuildingblocksofcomputerscience:howto representinformationinacomputer,howtomakecomputersdothingswithinformation,how tomakethemworkef®cientlyandreliably,howtomakethemsothatpeoplecanusethem. Pressingsocialissuesareraisedbycomputingtechnology,likehowinformationcanbekept privateandwhethercomputerswilleverbeasintelligentasus.Thereareperformanceissues: computersaremind-bogglinglyfast,yetpeoplearealwayscomplainingthattheircomputeris tooslow.Andtherearehumanissues:whydopeoplegetsofrustratedusingcomputers?Are computersgettingoutofcontrol?Behindtheseissueslieimportanttechnicalfactors,andthe activitiesinthisbookwillhelpyouunderstandwhattheyare. Wehaveselectedawiderangeoftopicsfromthe®eldofcomputerscience,andpackaged themsothattheycanbelearnedwithoutusingacomputer.Theywillgiveyouagoodideaof whatcomputerscanandcan'tdo,whattheymightbeabletodointhefuture,andsomeofthe problemsandopportunitiesthatcomputerscientistsfacenow. Butthemainreasonthatwewrotethisbookisbecausecomputerscienceisfun.Youdon't believeus?Ðreadon!Thesubjectisburstingwithfascinatingideasjustwaitingtobeexplored, andwewanttosharethemwithpeoplewhomightnotbetunedintocomputers,butwouldbe interestedintheideasincomputerscience.Theseactivitieswillcertainlygiveyousomething tothinkabout.

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Page1

INTRODUCTION

Theactivitiesandhowtousethem

Theactivitiesaredividedintosixtopics:data(representinginformation),puttingcomputersto work(algorithms),tellingcomputerswhattodo(representingprocedures),reallyhardprob- lems(intractability),sharingsecretsand®ghtingcrime(cryptography),andthehumanfaceof computing(interactingwithcomputers).Theseareasarerepresentativeofthekindsofthings thatcomputerscientistsstudy,althoughthelistisfarfromexhaustive.Eachtopichasabrief introductionexplainingwhereit®tsintothewiderpicture,followedbyseveralactivities. Alltheactivitiesbeginwithasummaryofmaterialsneeded.Anagegroupisgiven,butit ismerelyindicativeÐtheworkcanbeadaptedforanyonewhohasthebasicskills,andagreat dealdependsonthechildren'sbackground.Thereisnomaximumage.Althoughnearlyallthe activitiesaredesignedforelementaryschoolchildren,manyhavebeenusedwitholderchildren, andeventointroducetopicstouniversitystudents.Atimeisindicatedforeachactivity:this alsoisveryapproximate.Theactivitiesgenerallytakeabout30to40minutestocomplete, althoughtheycanbeadaptedtosuitthetimeavailable.Somecanserveasextendedprojects, andmostcanbecutdowntoa®ve-minutedemonstrationÐperhapsasanillustrationinalecture orseminar.Weindicatewhetherthereisaminimumormaximumnumberofpeoplerequired foranactivity.Althoughtheactivitiesaredescribedforaclassroomsituation,youwill®ndthat mostcanbeundertakenindividuallyorwiththehelpofasecondpersonsuchasaparentor friend. Eachactivitydescriptionhasthesamestructure.Theybeginwithafocussection,which listssomeofthekeyskillsthataredevelopedbytheactivity,andasummarysection,which providessomebackgroundtotheactivity.Thereisalistoftechnicaltermsthatmightseemlike jargon,butwillbeusefulifyouwanttopursuethetopicintotheprimaryscienti®cliterature. Thematerialspartgivesachecklistofwhatisrequiredtoundertaketheactivitywithaclass. Thenexttwosectionstakeyouthroughtheactivity.Whattodoisastep-by-stepexpla- nationofhowtopresentittochildren.Thestepsaretheresultofexperimentingwithseveral approaches,butyoushouldfeelfreetoadaptthemtosuityourgroup.Variationsandextensions suggestalternativewaystopresenttheactivity,andideasforextendingit. What'sitallabout?isintendedto®lltheteacherinonthewidersigni®canceoftheactivity. OlderchildrenmightappreciatehearingaboutsomeofthisÐyoumightevenhavethemreadthe sectionthemselves.Youngerchildrenmaynotbeabletocomprehendthebiggerpicture,andit isoftenbesttoletthemenjoytheactivityinitsownright,perhapswithasimpli®edaccountof itssigni®cance.Thissectionisalsointendedforparents.Somewillbecurious,andotherswill wanttotalkabouttheactivitieswiththeirchildathome.Itmayalsoproveusefulforjustifying theactivitiestoparentsorsupervisorswhoarenotconvincedoftheirvalue. Furtherreadingprovidesreferencestobooksandpapersonthetopic.Manyoftherefer- encesarefairlytechnical,butwehavetriedtoincludeoneswrittenforlaypeoplewherepossible. Ageneralreferencethatprovidesanaccessibleintroductiontomanyofthetopicsintheactiv- itiesisDavidHarel'sbookAlgorithmics:TheSpiritofComputing,whichwaspublishedina slightlylesstechnicalformasTheScienceofComputing.Completebibliographicinformation aboutallmaterialmentionedappearsattheendofthebook. Manyoftheactivitiesdeservearewardforgoodwork.Wehavemadethepictureonpage6 intoastamp,whichwedispensefreelyonworksheetsandthebacksofhandsinreturnfor Page2

INTRODUCTION

agoodeffort.Anyrubberstampshopwillbeabletomakeoneforyoufromacopyofthe picture.Anotherreasonforusingthisparticularstampisthatitremindschildrenthatthework isaboutcomputers,whichisimportantbecausethereisnotmuchmentionofcomputersduring theactivities.

Fortheteacher

Don'tbeputofffromusingtheseactivitiesjustbecauseyoufeelyoudon'tknowmuchabout computers.Despitethetechnicalnatureofthetopics,thisbookisintendedspeci®callyfor teacherswhohavenobackgroundincomputerscience.We®ndthatsuchpeopleoftenenjoy theactivitiesasmuchasthechildren.Theactivitiesaredesignedtoprovideopportunitiesfor teachersandstudentstolearntogetherabouttheprinciplesofcomputerscience.Toassistyou, everyactivityhasasectionthatexplainsitsbackgroundinnon-technicalterms.Answerstoall theproblemsareprovidedsothatyoucancon®rmthatyouhavethingsright. Mostoftheactivitiescanbeusedtosupplementamathematicsprogram,butsome(particu- larlyActivity19abouthumaninterfacedesignandActivity20aboutarti®cialintelligence)are alsoappropriateforsocialprograms.Thefocussectionidenti®esskillsthatthechildrenwill exercise,rangingfromrepresentingnumbersinbasetwotocoloring,fromlogicalreasoningto interviewing.Topicsandskillscanbelocatedusingtheindexatthebackofthebook.

Ifyouaren'texperiencedwithworkinginaclassroom...

Theseactivitiescanbeusedbycomputingprofessionalswhowouldliketocommunicatecom- puterscienceideastochildrenorothergeneralaudiences.Theyareidealforthoseoccasions whenyouareaskedtopresentsomethingaboutyourprofession,butrealizethatthecomputers thatyouworkwithareprobablynotnearlyasimpressiveasthevideogamesthatthechildren useeveryday. Ifyouaregoingtousetheseactivitiesinaclassroomsituation,particularlywithyounger children,gettingsomehelpfromateacheraboutkeepingorderintheclassroomcanmakethe timemoreproductive,andavoidfrustration.Therearesomefairlysafetechniquesthatwill workingeneral(suchasªI'llchoosesomeonesittingquietlywiththeirhandupº),althoughthe bestmethodvariesfromclasstoclass.Someteachershaverewardsystemsthatyoucanuse, oryoucanbringyourownrewardsÐsuchasstickers,orthestamponpage6.Theremaybea signalthattheteacherusestoindicatethateveryonemustbequiet.Thissortofinformationcan beveryvaluable! Forsomewhatexploratoryandopen-endedactivitiessuchasthese,itisnaturaltoexpecta rangeofresponsesfromindividualstudents.Oneeffectivestrategyistoemploythosestudents whorapidlyunderstandwhat'sgoingontoexplainthingstootherswhoarehavingmoredif®- culty.YoungerstudentsmaybecomequiteanimatedÐmoresothantheuniversitystudentsto whomyoumightbeaccustomed!Thegoalistodosomethinginterestingandtohavefun;a certainamountofchaosisnotnecessarilyabadthing. Don'tforgettocheckthelistofmaterialsrequired:it'seasytoforgetanimportantpiece ofequipment.Oftenthematerialswillbeavailablefromtheschool(suchasbalancescales, Page3

INTRODUCTION

crayons,andchalk).Ifyouarenotinvolvedintheteachingprofession,youmaynotrealizethat theprobabilityofaphotocopierbreakingdownisparticularlyhighinthe®veminutesbeforea classforwhichyouneedasetofhandouts. Manyoftheactivitiesinvolvesolvingproblems.Inmostcases,theintentionisnottoexplain howtosolvetheproblem,buttoallowthechildrentounderstanditand®ndtheirownmethodof solution.Knowinganalgorithmthatsolvesaproblemhaslittleintrinsicvalue,buttheprocess ofdiscoveringanalgorithm(evenifitisnotthebestone)canbeveryinstructive.Insomecases thereisnogoodalgorithm;rather,theintentionisforthechildrentolearnabouttheinherent complexityoftheproblem.Sometimestherewillbeanopportunitytoexplaintothechildren howaparticularproblemappliestotherealworld,butoftenitwillsuf®ceforchildrentoseethe eleganceofasolution,orappreciatethatsomeproblemsdon'thaveeasysolutions. Aboveall,thereisnosubstituteforenthusiasmandbeingwellprepared.Childrenappreciate bothoftheseandrespondaccordingly.Andifyouarefromoutsidetheclassyouhavethe advantagethatthechildrenmaybemoreattentivebecauseyouareofferingabreakfromthe dailyroutine.

Forthetechnically-minded

Aswellasprovidingatasteofcomputerscienceforchildren,wehaveincludedsomematerial forthosewhowouldliketodelvealittledeeperintothesubject.Likethisone,thesesections aremarkedªforthetechnically-minded.º Oneofourgoalsistocommunicatewhatcomputerscienceisreallyabout.Computersci- enceisarichsubjectconcernedwithwhatcomputerscanandcannotdo,howtoapproachprob- lems,andhowtomakecomputersmorevaluabletotheirusers.Verylittlecomputerscienceis taughtinelementaryandhighschool.Moststudentswilldosomesortofªcomputingºwork, butusuallyitisabouthowtousecomputersratherthanhowtodesignthemforotherpeopleto use.Acommonmisconceptionisthatcomputerscienceisaboutprogramming.Programming isafundamentaltool,butitisnottheendinitself.Computerscienceisaboutprogramming inthesamewaythatastronomyisabouttelescopesÐjustaslearningastronomyneednotin- volveunderstandinghowatelescopeisbuilt,learningaboutcomputersciencedoesnotneedto involveprogramming.Infact,muchofcomputersciencewouldexistevenifcomputersdidn't (althoughitwouldprobablyhaveadifferentname!)Noneoftheactivitiesinthisbookrequire acomputer,buttheprinciplesthattheyteacharewidelyusedinmoderncomputers. FewyoungstersÐorevenadultsÐareawareofwhatcomputersreallycanandcan'tdo.For example,manyreal-lifeoptimizationproblems,suchastime-tablingteachersandclasses,or ®ndingtheshortestroutetomakedeliveries,taketoolongtosolveoptimallyoncomputersÐ regardlessofhowfastthecomputeris.Thereareevenproblems,suchassolvingsomeequations (knownasDiophantineequations),thatwecanprovewillneverbesolvedbyacomputer.There arelotsofthingsthatcomputerscan'tdo. Manythingsthatcomputerscandoarealsonotwidelyknown.Forexample,manypeople usedebitcardstopayforgoods,wheremoneyistransferreddirectlyfromtheirbankaccount tothestore's.However,intheprocessthebank®ndsoutwherethepurchaseisbeingmade, andcouldbuildupapro®leoftheperson'sshoppinghabits.Despitethislossofprivacy,debit Page4

INTRODUCTION

cardsarewidelyaccepted.Mostpeopleareunawarethatcryptographicprotocolsexistwhich enablethetransactiontobecarriedoutreliablywithoutthebankbeingabletoidentifywhothe moneyisgoingto!ThisseemsincredibleÐliterallyunbelievableÐtopeoplewhohavenever encounteredpublickeycryptosystemsandinformationhidingprotocols.Ifmorepeopleknow aboutsuchthings,theremaywellbeanoutcryforsystemsthatprotectprivacybetter.(Activ- ity16oninformationhidingprotocolsdemonstratesasituationwhereitispossibletoexchange informationwithoutlosinganyprivacy).Understandingthetechnicalissuesinvolvedgoesa longwaytomakinginformeddecisionsonprivacyissues,justasanunderstandingofbiology goesalongwaytomakinginformeddecisionsonenvironmentalissues. Wehopethatthisbookwilltakesomeofthescience®ctionoutofpeople'sunderstandingof computers.Theupcominggenerationofcomputerusersdeservesaclearviewofthetechnical issuesthatunderpinthemyriadofcomputerizedsystemsthatpermeateourlives. To®ndoutmoreabouttheªUnpluggedºproject,visitthewebsiteat http://unplugged.canterbury.ac.nz/. Page5 Instructions:Havethispicturemadeintoarubberstamp(abouthalfthissize)anduseitasarewardforgoodwork.

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Page6

PartI

Data:therawmaterialÐRepresenting

information

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Page7

Dataistherawmaterialthatcomputersworkon.Peopleusedtothinkofcomputersasgiant electroniccalculators.Butnowadaysit'sbettertothinkofacomputerasacrossbetweenan electronic®lingcabinet,alibrary,andaTV.Calculatorsworkwithnumbers.Butcomputers workwithdataofanykind:baseballlore,sportsfacts,letters,mailinglists,accounts,pay- rolls,advertisements,magazines,books,encyclopedias,music,movielistingsÐevenmovies themselves.Calculatorsdoarithmeticonnumbers.Computerscandothattoo.Butmoreim- portantly,theycanmanipulateallsortsofdata,lookingforhigh-scoringplayers,predictingthe outcomeofbaseballgames,helpingtowriteletters,addressenvelopes,balanceaccounts,print checks,distributeadvertisements,layoutmagazinepages,®ndinformationinbooksandency- clopedias,playmusic,lookthroughmovielistingsÐtheycanevenshowmovies.Whatisreally amazingisthatallofthiswiderangeoffacts,documentsandimagesarestoredonamachine that,atthelowestlevel,onlyworkswithtwothings:zeroandone! Inthispartofthebookwelookathowdifferentkindsofinformationcanberepresented byacomputer.Internally,allcomputersstoredatainanelectronicformthatisbasedonavery simpleidea:thateverythingcanbecodedasasequenceofthedigitszeroandone.You,theuser, donotnormallyseethesethingsbecausethedataispresentedinahuman-readableformÐwho wantstoseeabunchofnumbersinsteadofamovie?Buttounderstandwhatcomputersdo,you needtoknowwhatitisthattheyworkwith,andhownumbers,letters,words,andpicturescan beconvertedintozerosandones.

Forteachers

Representinginformationisabsolutelyfundamentaltocomputing.Althoughthediffer- enceishardtopindownprecisely,data,whichdictionariesde®neasªnumericalinforma- tioninaformsuitableforprocessingbycomputer,ºissubtlydifferentfrominformation, orªknowledgederivedfromstudy,experience,orinstruction.ºWerefertothestuffthatis storedandmanipulatedbycomputersasdata,andthereal-worldentitiesthataresorep- resentedasinformation.Thusdataistherawmaterialofcomputing,whileinformation istherawmaterialofcomputerapplications.3Informationisconvertedintodataforthe computer,anddataispresentedasinformationtotheuser. The®veactivitiesinthissectionprovideabroadintroductiontoinformationrepresenta- tion.The®rstisaboutbinarynumbers,disguisedasagamethatevenveryyoungchildren enjoyplaying.Thesecond,akindofªpaintbynumbersºactivity,showshowpictures canberepresentedasnumbers,andembodiesconventionsusedinfaxmachinesfortrans- mittingimagesoverphonelines.Thenexttwoactivitiesareaboutwaysofrepresenting informationthatareef®cientandreliable.Dataoftenconsumesvastquantitiesofcom- puterdiskspaceÐthisisparticularlytrueofmulti-mediamaterialcontainingsoundand images.Computeruserswilltestifythattheyneverseemtohavequiteenoughdiskspace, andsocomputerscientistsareconcernednotjustwithhowtostoredata,buthowtostore itef®ciently.Activity3showshowordinarytextcanberepresentedasnumbersinan ef®cientway.Thenextactivityisaboutmaintainingtheintegrityofthedata.Themedia

3Weusedatainthesingular,becauseitusuallyseemslikealargeÐoftenformidablylargeÐentityinitself,rather

thanacollectionofindividualªdatums.º Page9 onwhichdataisstored(andtransmitted)issusceptibletotheoccasionalerror,anditis importantthattheeffectoferrorsisnegligible.Disguisedasamagictrick,weintroduce awidely-usedtechniquetodetectandcorrectminorerrorsincomputerdata.The®nal activityinthissectionisabouthowinformationcanbequanti®ed.Becausetheideaof informationissocentraltocomputerscience,awholetheoryhasbeendevelopedthat enablesustoquantifyinformationand®ndlimitsonhowef®cientlyitcanbestoredand transmitted. Takentogether,theseactivitieswillhelpchildrenunderstandhowdifferentkindsofinfor- mationcanbestoredonacomputer,withouttakingupmorespacethannecessary,andin awaythatdecreasesthechanceoflossofdataduetodefectsinthestoragemedium.They willalsolearnabouthowtomeasuretheinformationcontentofdata.Theactivitiescan beperformedinanyorder,thoughitishelpfulifActivity1isdone®rst.The®rstthree aresuitableforchildreninearlyelementaryschool,whileforthelasttwothechildren needtobeatthemiddleelementarylevel.However,thesearelowerbounds:evenquite advancedchildrenenjoytheseactivitiesandlearnfromthem,asdoadults.

Forthetechnically-minded

Manycomputerprofessionalswillbesurprisedatthecontentoftheseactivities.Pro- gressingfrombinarynumbers,throughpicturerepresentation,totextcompression,error control,andfoundationsofinformationtheory,constitutesaratherunusualintroduction tocomputerscience.Indeed,manystudentsofthesubjectareunfamiliarwithsomeof theseideas. No-onewoulddisagreethatinformationrepresentationisbasictocomputing.Butthe traditionalfareofintegers,floating-pointnumbers,andcharacterstringsconveysanim- poverishedandpedestrianviewofinformation.Picturesandtextarewhatuserssee,and inthissensetheyarethefundamentaldatatypesincomputingtoday.Insteadofwork- ingtowardstructureddataÐsuchaslists,trees,andobjecthierarchiesÐthewaymany computingtechnologyandprogrammingcoursesdo,wepursueauser-orientedtrack.Ef- ®cientstorageofinformation,anditsintegrity,arethemajorissuesofconcern.Afeeling forhowinformationisquanti®edunderpinsourunderstandingofwhatitisthatcomputers workwith.Thesetopicsprovideaviewofcomputingthatyoungchildrencanrelateto, andtheylendthemselvesnaturallytosimplebutintriguingactivities.

Page10

Activity1

CountthedotsÐBinarynumbers

AgegroupEarlyelementaryandup.

AbilitiesassumedCountingupto15or31,matching,sequencing.

Time10to40minutes.

SizeofgroupFromindividualstothewholeclass.

Focus

Representingnumbersinbasetwo.

Patternsandrelationshipsinpowersoftwo.

Summary

Alldatainamoderndigitalcomputerisultimatelystoredandtransmittedasaseriesof zerosandones.Thisactivitydemonstrateshownumbersandtextcanberepresentedusing justthesetwosymbols.

Technicalterms

Binarynumberrepresentation;binarytodecimalconversion;bitsandbytes;character sets.

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Page11

ACTIVITY1.COUNTTHEDOTSÐBINARYNUMBERS

Figure1.1:Initiallayoutofthebinarycards

Figure1.2:Flippingthecardstoshow®vedots

Materials

Eachchildwillneed:

onesetof®vecardsfromtheblacklinemasteronpage17(theblacklinemasterhastwo sets), acopyoftheblacklinemasteronpage18,and apenorpencil.

Whattodo

1.Seatthechildrenwheretheycanseeyou,andgiveeachchildasetofcards.

2.Thechildrenshouldlaytheircardsout,asinFigure1.1,withthe16-dotcardtotheirleft.

Somechildrenwillbetemptedtoputthecardsintheoppositeorder,soyoushouldcheck thattheyareindescendingnumericorderfromlefttoright.Foryoungerchildren,donot usethe16-dotcard.

Page12

ACTIVITY1.COUNTTHEDOTSÐBINARYNUMBERS

Figure1.3:Solutiontotheworksheetonpage18

3.Havethechildrenworkoutwhichcardstoflipoversothatexactly®vedotsareshowing.

Theonly(correct)waytodothisistohavethe4-dotand1-dotcardsfaceup,andtherest facedown(Figure1.2).Eachcardmustbeeitherfaceuporfacedown,withallornoneof itsdotsshowing.Bepreparedforsomenovelwaysofgetting®vedotsÐitisnotunusual forchildrentoproducetherequisitenumberbyusingsparecardstocoverupthreeofthe dotsontheeightcard!

4.Nowgetthechildrentoshowothernumbersofdots,sothattheyexplorewhichnumbers

canberepresented. Askfornumberssuchasthree(requirescards2and1),twelve(8and4),nineteen(16,2 and1)andsoon.Forthosewho®ndthecombinationforanumberquickly,askifthey can®ndanotherwaytogetthenumber(thereisonlyonewaytodisplayeachnumber, andtheyarelikelytodiscoverthiseventually). Discusswhatthebiggestnumberisthatcanbemadewiththecards(itis31for®vecards,

15forfourcards).Thesmallest?(Oftenthenumberonewillbeoffered®rst,butthe

correctansweriszero.)Isthereanynumberbetweenthesmallestandlargestthatcan'tbe represented?(NoÐallnumberscanberepresented,andeachhasauniquerepresentation.)

5.Forolderchildren,askthemtodisplaythenumbers1,2,3,4,...insequence,andseeif

theycanworkoutaprocedureforincrementingthenumberofdotsdisplayedonthecards byone(thenumberofdotsincreasesbyoneifyouflipallcardsfromrighttoleftuntil youturnonefaceup).

Page13

ACTIVITY1.COUNTTHEDOTSÐBINARYNUMBERS

6.Thispartoftheactivityuseszerosandonestorepresentwhetheracardisfaceupornot.

Tellthechildrenthatwewillusea0toshowthatacardishidden,anda1ifitsfaceis showing.Forexample,thepatterninFigure1.2isrepresentedby00101.Givethemsome othernumberstoworkout(e.g.10101represents21,11111represents31).Withsome practicethechildrenwillbeabletoconvertinbothdirections.Youcouldaskchildrento taketurnscallingoutthedayofthemonththattheywerebornonusingzerosandones, andhavetherestoftheclassinterpretthedate. Thisrepresentationiscalledthebinarysystem,alsoknownasbasetwo.

7.Usetheworksheetonpage18toextendtheexercise.(Acompletedworksheetisshown

inFigure1.3.) Theworksheetusesalightbulbthatisswitchedontorepresentacardthatisshowing, andalightbulbthatisofftorepresentahiddencard.The®rstfewpatternsshouldbe easytoworkout.Forexample,the®rstpatternhasthe8and1cardsshowing,sothe valuerepresentedis8+1=9.Forthepatternswithfewerthan®velightbulbs,the childrenshoulduseonlythesmallervaluedcards.Forexample,thesecondpatternhas onlythreelightbulbs,whichcorrespond(fromlefttoright)tothe4-,2-,and1-dotcards respectively.Seeifthechildrencanworkthisoutforthemselves. Thesix-bulbquestionsaredesignedtomakethechildrenthinkabouthowmanydots shouldbeonasixthcard.Thenumberofdotsoneachcardisdoublethenumberonthe previousone,sothesequenceis1,2,4,8,16,32,64....Thusa32-dotcardwouldbe added(attheleft)tosolveaproblemthatneedssixcards. Thecodeatthebottomoftheworksheetusesthenumbers1to26torepresenttheletters ofthealphabet.(Azerocanbeusedtorepresentaspace.)Thechildrenmustworkout whateachnumberinthecodeis,andlookupthecorrespondingletterinthetable.This showshowatextualmessagecanbeconvertedtoaseriesofzerosandones.Thechildren canthenwritecodedmessagesforeachother.

Variationsandextensions

Insteadofusingcardswithdots,theexercisecanbedonewiththelengthsofrods(asetofrods oflengths1,2,4,8and16unitscanbeusedtocreateanylengthfrom0to31)orwithweights (asetofweightsof1,2,4,8and16unitscanbecombinedtoproduceanyweightfrom0to31). Insteadofcallingoutsequenceslike01101,tryusingbeepsÐcalloutahigh-pitchedbeepfor aoneandalow-pitchedoneforazero.Thisactivityisnoisyintheclassroom,butchildren®nd itmemorable!Modemsandfaxmachinesusetoneslikethistotransmitinformation,although thetonesaresentsoquicklythattheyblendtomakeacontinuousscreechingsound.Ifthe childrenaren'tfamiliarwiththis,theycouldtrycallingafaxmachinenumbertohearwhatit soundslike. Anyobjectsthathavetwostatescanbeusedtorepresentnumbers.Figure1.4showssome differentwaysofrepresentingthenumbernine(01001).Aparticularlychallengingmethodis touseyour®ngers.Ifa®ngerisupitrepresentsaone;downrepresentszero.Countingonyour

Page14

ACTIVITY1.COUNTTHEDOTSÐBINARYNUMBERS

Figure1.4:Someunusualwaysofrepresentingthenumbernine(01001inbinary) ®ngersusingthebinarysystemenablesyoutogoupto31ononehand,and1023ontwohands. Itrequiressomedexterity,andyouhavetowatchoutforrudegesturesalongtheway!Forareal challenge,tryusingyourtoesaswellÐthiswillallowyoutocountuptomorethanamillion. (Howmanyexactly?Twohandsgive1024possibilities,0through1023.Handsandtoesgive

10241024=1;048;576possibilities,0through1,048,575.)

Olderchildrenwillenjoyextendingthesequence1,2,4,8,16,32...Thesequencecontains aninterestingrelationship:ifyouaddthenumbersfromthebeginningfromlefttoright,thesum willalwaysbeonelessthanthenextnumberinthesequence. Anotherpropertyofbinarynumbersisthatyoucandoublethenumberbyinsertingazero ontheright-handsideofanumber.Forexample,1001(9)doubledis10010(18).Olderchildren shouldbeabletoexplainwhythishappens.(Alloftheplacescontainingaonearenowworth twicetheirpreviousvalue,andsothetotalnumberdoubles.Thesameeffectoccursinbaseten, whereinsertingazeroontherightofanumbermultipliesitbyten.) Binarynumbersarecloselyrelatedtotheguessinggameinwhichonepersonthinksofa numberandsomeoneelsetriestoguessitbyaskingquestionsoftheformªisitgreaterthanor equaltox?ºForexample,supposethenumberisknowntobelessthan32.Asensible®rst questionwouldbeªisitlessthan16?ºTheyes/noanswerstothequestionsaregivenbythe zero/onebitsinthebinaryrepresentationofthenumber.ThisisexploredindetailinActivity5. The®ve-bitcodeusedforlettersdoesnotallowbothupper-andlower-caseletterstobe represented.Youcouldhavethechildrenworkouthowmanydifferentcharactersacomputer hastorepresent(includingdigits,punctuation,andspecialsymbolssuchas$),andconsequently howmanybitsareneededtostoreacharacter.(Withtwolotsof26letters,10digits,andafew punctuationmarks,thereareboundtobemorethan64codesneeded,soatleastsevenbits arenecessary.Sevenbitsallowsfor128characters,andthisismorethansuf®cient.)Most currentcomputersusearepresentationcalledASCII(AmericanStandardCodeforInformation Interchange),whichisbasedonusingsevenbitspercharacter.Longercodesthatallowforthe languagesofnon-Englishspeakingcountriesarenowbecomingcommon.

Page15

ACTIVITY1.COUNTTHEDOTSÐBINARYNUMBERS

What'sitallabout?

Moderndigitalcomputersalmostexclusivelyusethesystemdescribedabovetorepresentin- formation.Thesystemiscalledbinarybecauseonlytwodifferentdigitsareused.Itisalso knownasbasetwo(asopposedtobaseten,whichhumansnormallyuse).Eachzeroorone iscalledaªbitº,thetermbeingacontractionofbinarydigit.Abitisusuallyrepresentedina computer'smainmemorybyatransistorthatisswitchedonoroff,oracapacitorthatischarged ordischarged.Onmagneticdisks(¯oppydisksandharddisks),bitsarerepresentedbythedi- rectionofamagnetic®eldonacoatedsurface,eitherNorth-SouthorSouth-North.CD-ROMs storebitsopticallyÐthepartofthesurfacecorrespondingtoabiteitherdoesordoesnotre¯ect light.Whendatamustbetransmittedoveratelephonelineorradiolink,theonesandzerosare commonlyrepresentedbyhigh-andlow-pitchedtones. Onebitonitsowncan'trepresentmuch,sotheyareusuallygroupedtogetherasinthe exerciseabove.Itisverycommontostorebitsingroupsofeight,whichcanrepresentnumbers from0to255.Agroupofeightbitsiscalledabyte. Aswellasrepresentingnumbers,thiscodecanalsorepresentthecharactersinaword- processordocument.AbyteisoftenusedtorepresentasinglecharacterinatextÐthenumbers0 to255aremorethanenoughtoencodealltheupper-andlower-caseletters,digits,punctuation, andmanyothersymbols. Torepresentlargernumbers,severalbytesaregroupedtogether.Twobytes(16bits)can represent65,536differentvalues,andfourbytescanrepresentover4billionvalues.Thespeed ofacomputerisaffectedbythenumberofbitsitcanprocessatonce.Forexample,a32- bitcomputercanperformarithmeticandmanipulationson32-bitnumbers,whereasa16-bit computermustbreaklargenumbersinto16-bitquantities,makingitslower. Normallywedon'tseethebitsandbytesinacomputerdirectlybecausetheyareautomati- callyconvertedtocharactersandnumberswhentheyaredisplayed,butultimatelybitsandbytes areallthatacomputerusestostorenumbers,text,andallotherinformation.

Furtherreading

Mostintroductorycomputingtextsdiscussthebinarynumbersystem.MyfriendArnold'sbook ofPersonalComputersbyGarethPowellhasawholechapteronbinarynumbers.

Page16

Instructions:Copythispageontocard,andcutouttheboxestomaketwosetsoffivecards.

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Page17

Instructions:Workoutthenumbersrepresentedbythelightbulbsatthetopofthepage.Also,thereisamessagecodedinbinaryatthebottomofthepage;workoutthenumbersandlookthemupinthetabletogetthemessage.

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Page18

Activity2

ColorbynumbersÐImage

representation

AgegroupEarlyelementaryandup.

AbilitiesassumedElementarycounting,andsomeconcentration.Activ- ity1(CounttheDots)ishelpful,butnotessential, preparation.Experiencewithgraphingisalsouseful.

Time20minutesormore.

SizeofgroupFromindividualstothewholeclass.

Focus

Representation.

Coloring.

Pictures.

Summary

Computersareoftenusedtostoredrawings,photographsandotherpictures.Thisactivity showshowpicturescanberepresentedef®cientlyasnumbersinacomputer.

Technicalterms

Rasterimages;pixels;imagecompression;run-lengthcoding;facsimilemachines.

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Page19

ACTIVITY2.COLORBYNUMBERSÐIMAGEREPRESENTATION

Figure2.1:Theletterªaºfromacomputerscreen,andamagni®edviewshowingthepixelsthat makeuptheimage.

Materials

Eachchildwillneed:

acopyoftheblacklinemasteronpage25,and apencilanderaser.

Youwillneed:

anoverheadprojectortransparencyofFigure2.1(ordrawitontheclassroomboard).

Whattodo

1.Discusswhatfacsimile(fax)machinesdo(arrangingforthechildrentosendand/orre-

ceivefaxeswouldbeexcellentpreparationforthisactivity).Askforotherplaceswhere computersstorepictures(forexample,adrawingprogram,agamewithgraphicsinit,or amulti-mediasystem). Explainthatcomputerscanreallyonlystorenumbers(iftheyhavedonetheactivityon binarynumbersthentheywillalreadyhavesomeappreciationofthis).Havethechildren suggesthowapicturemightberepresentedusingonlynumbers.

2.Demonstratehowimagesaredisplayedonacomputerscreen,asfollows:

Computerscreensaredividedupintoagridofsmalldotscalledpixels.Thewordpixel isacontractionofªpictureelement.ºOnablackandwhitescreen,eachpixeliseither blackorwhite.Figure2.1showsapictureofaletterªaºthathasbeenmagni®edsothat thedotsarevisible.(Thisimageshouldbeshownonanoverheadprojector,ordrawnon theboard.)Whenacomputerstoresapicture,allthatitneedstostoreiswhichdotsare blackandwhicharewhite.

3.UsingtheimageofFigure2.1,demonstratehowpicturescanberepresentedbynumbers

ontheblackboard,asfollows: Beginbywritingdownthenumberofconsecutivewhitepixelsinthe®rstlineofthe image(inFigure2.1thereisonlyonewhitepixelatthestartofthe®rstline).Thenwrite

Page20

ACTIVITY2.COLORBYNUMBERSÐIMAGEREPRESENTATION

Figure2.2:TheimageofFigure2.1codedusingnumbers

downthenumberofconsecutiveblackpixels(three),andsoonuntilthewholelinehas beencoded.Thusthe®rstlineofFigure2.1willberepresentedas1,3,1.Eachrow ofpixelsintheimageistranscribedusingthismethod.Forexample,thesecondlineof Figure2.1isrepresentedby4,1,sinceithasfourwhitepixelsfollowedbyoneblackone. Figure2.2showsthe®nalrepresentationofFigure2.1.Noticethatlinesbeginningwith ablackpixelhaveazeroatthebeginningtoindicatethattherearenowhitepixelsatthe startoftheline. Theremaybesomeconfusionwiththisdemonstrationifyouuseachalkboard,because coloringinapixelmakesitwhiteratherthanblack!

4.Havethechildrenªdecodeºthepicturesontheworksheetonpage25.

Handouttheworksheetsandgetthechildrentodeciphertheimagesthere(seeFigure2.3 forthecompletedimages;Figure2.4containsareducedversionwhichmakesthepictures clearer).Theªtestºpictureontherightistheeasiest,andtheªbeingºontheleftisthe mostcomplex.1Thesquaresonthegridshouldbecoloredincompletely,andmadeas darkaspossible.Ifthesquaresontheblacklinemasteraretoosmall,youcanusequad- ruledpaper.Itisimportanttousepencil,asmistakesareeasilymade!Childrenshould markeachlineofnumbersasthey®nishwithit.Somemayprefertocircleallthenumbers thatrepresentblackpixelstohelpthemkeeptrackofwheretheyareuptoÐitisveryeasy togetconfusedaboutwhichnumbersareforblackandwhichareforwhite. Notethateachlinealwaysbeginswiththenumberofwhitepixels.Ifthe®rstpixelis black,thelinewillbeginwithazero.

Variationsandextensions

Theimagewillbeclearerifthechildrendrawonasheetoftracingpaperontopofthegrid,so thatthe®nalimagecanbeviewedwithoutthegrid. Insteadofcoloringinthegridtheclasscouldusesquaresofstickypaperonalargergrid,or placeanyobjectsonagrid.Thecodescouldevenbeusedforacross-stitchpattern.

1Theimagesaretakenfromtheexcellentchildren'sdrawingprogramKidPix,byBrøderbundSoftware.

Page21

ACTIVITY2.COLORBYNUMBERSÐIMAGEREPRESENTATION

Figure2.3:Thecompletedimages

Figure2.4:Thecompletedimagesreduced

Page22

ACTIVITY2.COLORBYNUMBERSÐIMAGEREPRESENTATION

Childrencantrydrawingtheirownpicturesonagrid(ortrytocopyonefromacomputer screen).Theycancodethepictureasnumbersandgiveittofriendstodecipher. Inpracticethereisusuallyalimittothemaximumlengthofarunofpixelsbecausethe lengthisbeingrepresentedasabinarynumber.Askthechildrenhowtheywouldrepresenta runoftwelveblackpixelsiftheycouldonlyusenumbersuptoseven.(Agoodwayistocodea runofsevenblackpixels,followedbyarunofzerowhite,thenarunof®veblack.) Themethodcanbeextendedtocoloredimagesbyusinganumbertorepresentthecolor (e.g.0isblack,1isred,2isgreenetc.)Twonumbersarenowusedtorepresentarunofpixels: the®rstgivesthelengthoftherunasbefore,andthesecondspeci®esthecolor.

What'sitallabout?

Thesimplestwaytorepresentablackandwhitepictureonacomputeristorepresentwhite pixelswithazero(say)andblackwithaone.However,itiscommonforimagestocontain largeblocksofwhitepixels(especiallyinthemargins)andrunsofblackpixels(e.g.ahorizontal line).Facsimiledocumentscommonlyhaveabout100pixelsperinch,soarowofwhitepixels atthetopofa7inchwidepagecouldtake700bitsofstorage. Theªrun-lengthcodingºthatweusedintheactivityaboveismuchmoreef®cient.Itrep- resentstherun-lengthof700usingthebinarysystem(seeActivity1),whichcanbedonein10 bits.Thisexampleisalittleextreme,butneverthelesssigni®cantsavingscanbemade. Savingspaceusingtechniqueslikethisiscalledcompression,anditiscrucialtotheviability ofworkingwithimagesoncomputers.Forexample,faximagesaregenerallycompressedto aboutaseventhoftheiroriginalsize.Withoutcompressiontheywouldtakeseventimesaslong totransmit,whichwouldmakefaxamuchlessattractivemeansofcommunication.Images storedoncomputerdisksareoftencompressedtoatenthorevenahundredthoftheiroriginal size.Withoutcompressiontheremightberoomforjustahandfulofimagesonthedisk,but withcompressionmanymoreimagescanbestored.Theadvantageisevengreaterwhenstoring movingpictures,whichnormallyinvolve25ormoreimageseachsecond.Thecompression methodusedinthisactivityisrelatedtothemethodusedonmostcommonfaxmachines.A hostofothermethodsarealsoavailable.TheonesthatgivethebestcompressionareªlossyºÐ theychangetheimageveryslightlysothatitcanbestoredmuchmoreef®ciently. Isthereadown-side?Ðcanªcompressingºanimageeverexpandit?Well,yes.Achecker- boardimageinwhichpixelsalternateblackandwhitewouldbemuchmoreef®cienttostore usingonebitforeachpixelthanusingonenumberforeachpixel,becauseitwillbenecessary torepresentthenumberasseveralbitstoallowforthepossibilityoflongerruns.Although thisparticularcaseisunlikely,somerealimagesÐsuchashalftoneimages,likeillustrations innewspapers,thataremadeupoflotsoftinydotsÐdonotcompresswellandmayevenex- pand.Itissometimesnecessarytotailortherepresentationmethodtothekindofimagebeing represented.

Page23

ACTIVITY2.COLORBYNUMBERSÐIMAGEREPRESENTATION

Furtherreading

RepresentingimagesoncomputersisdiscussedindepthbyNetravaliandHaskellinDigital pictures:representationandcompression.Thestandardmethodforcodingonfaxmachinesis describedbyHunterandRobinsoninapaperpublishedin1978entitledªInternationaldigital facsimilecodingstandards.ºAmorerecentstandardforcodingimagesisdescribedinthebook JPEG:StillImageDataCompressionStandardbyPennebakerandMitchell.

Page24

Instructions:Usethenumberstocolorinthesquares.Thereisarowofnumbersforeachlineinthepicture.Forexample,theline4,9,2,1meanstoleave4squaresempty,colorin9,leave2empty,andcolorinthenextone.

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Page25

ACTIVITY2.COLORBYNUMBERSÐIMAGEREPRESENTATION

Page26

Activity3

Youcansaythatagain!ÐText

compression

AgegroupEarlyelementaryandup.

AbilitiesassumedCopyingwrittentext.

Time10minutesormore.

SizeofgroupFromindividualstothewholeclass.

Focus

Writing.

Copying.

Repetitioninwrittentext.

Summary

Despitethemassivecapacityofmoderncomputerstoragedevices,thereisstillaneedfor systemstostoredataasef®cientlyaspossible.Bycodingdatabeforeitisstored,and decodingitwhenitisretrieved,thestoragecapacityofacomputercanbeincreasedat theexpenseofslightlysloweraccesstime.Thisactivityshowshowtextcanbecodedto reducethespaceneededtostoreit.

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Page27

ACTIVITY3.YOUCANSAYTHATAGAIN!ÐTEXTCOMPRESSION

Technicalterms

Textcompression;Ziv-Lempelcoding.

Materials

Eachchildwillneed:

acopyoftheblacklinemasteronpage32.

Youwillalsoneed:

acopyofotherpoemsortextforthechildrentoencode.

Whattodo

1.Giveeachchildacopyoftheblacklinemasteronpage32,andhavethemªdecodeºthe

messageby®llinginemptyboxeswiththecontentsoftheboxthattheirarrowpointsto. Forexample,the®rstemptyboxshouldcontainthelettere.The®rstemptyboxonthe secondlinereferstothephrasePeaseporridgeonthe®rstline.Thecompletedworksheet isshowninFigure3.1.

2.Nowhavethechildrenwritetheirownrepresentationofsometextusingboxesandarrows.

Thegoalistohaveasfewoftheoriginalcharactersleftaspossible.Thearrowsshould alwayspointtoanearlierpartofthetexttoensurethatitcanbedecodediftheboxes are®lledinfromtoptobottom,lefttoright.Thechildrencaneitherchoosetheirown text,makesomeup,orencodesomethathasbeenprovided.Manynurseryrhymesand poemsforchildrencanbecodedparticularlyeffectivelybecausetheytendtohavealot ofrepetition,atleastintherhymingparts1.BookssuchasDr.Seuss'sªGreeneggsand hamºalsoprovideagoodsourceofcompressibletext.

Variationsandextensions

Thearrow-and-boxcoderequiresthatarrowsalwayspointtoanearlierpieceoftext,although itisonlythe®rstletterpointedtothatneedstobeearlier.Forexample,Figure3.2showsa codedversionofthewordªBanana.ºEventhoughthemissingtextpointstopartofitself,it canbedecodedcorrectlyprovidedthelettersarecopiedfromlefttorightÐeachletterbecomes availableforcopyingbeforeitisneeded.Thiskindofself-referentialrepresentationisusefulif thereisalongrunofaparticularcharacterorpattern. Oncomputerstheboxesandarrowsarerepresentedbynumbers.Forexample,thecodein Figure3.2mightberepresentedasªBan(2,3)º,wherethe2meanscountbacktwocharacters

1AgoodrhymeisªAdillar,adollar/ateno'clockscholar/whatmakesyoucomesosoon/youusedtocomeat

teno'clock/andnowyoucomeatnoon.º

Page28

ACTIVITY3.YOUCANSAYTHATAGAIN!ÐTEXTCOMPRESSION

Figure3.1:Thecompletedworksheet

Figure3.2:Aself-referentialcode

Page29

ACTIVITY3.YOUCANSAYTHATAGAIN!ÐTEXTCOMPRESSION

to®ndthestartingpointforcopying,andthe3meanscopythreeconsecutivecharacters.On acomputerthepairofnumberstypicallytakeupasimilaramountofspacetotwoletters,so matchesofonlyonecharacterarenotnormallyencoded.Childrencouldtryencodingand decodingtextsusingthenumberrepresentation. Togetafeelforhowthistechniquewouldworkonrealtext,childrencouldbegivena photocopiedpagecontainingaquantityoftext,andstartingabouthalf-waydownthepage, crossoutanytextthatcouldbereplacedbyapointertoanearlieroccurrence.Theearlier occurrencesshouldonlybegroupsoftwoormoreletters,sincethereisnosavingifasingle letterissubstitutedwithtwonumbers.Thegoalistogetasmanyletterscrossedoutaspossible.

What'sitallabout?

ThestoragecapacityofcomputersisgrowingatanunbelievablerateÐinthelast25years,the amountofstorageprovidedonatypicalcomputerhasgrownaboutamillionfoldÐbutinstead ofsatisfyingdemand,thegrowthisfuelingit.Theabilityofcomputerstostorewholebooks suggeststhepossibilityofstoringlibrariesofbooksoncomputer;beingabletoshowahigh qualityimageonacomputersuggestsdisplayingmovies;andtheavailabilityofhighcapacity CD-ROMsimpli®esthedistributionofdataandprogramsthathadpreviouslybeenlimitedby thesizeofa¯oppydisk.Anyonewhoownsacomputerwillhaveexperiencedthevariationof Parkinson'slawthatstatesthatthedataalwaysexpandsto®llthestorageavailableforit. Analternativetobuyingmorestoragespaceistocompressthedataonhand.Thisactivity illustratesthecompressionprocess:therepresentationofthedataischangedsothatittakesup lessspace.Theprocessofcompressinganddecompressingthedataisnormallydoneautomati- callybythecomputer,andtheuserneednotevenbeawarethatitisbeingdoneexceptthatthey mightnoticethatthediskholdsmore,andthatittakesalittlemoretimetoget®lesfromthe disk.Essentiallysomecomputingtimeisbeingtradedforstoragespace.Sometimesthesystem canevenbefasterusingcompressionbecausethereislesstoreadfromthedisk,andthismore thancompensatesforthesmallamountoftimeneededtodecompressthematerial. Manymethodsofcompressionhavebeeninvented.Theprincipleofpointingtoearlier occurrencesofchunksoftextisapopulartechnique,oftenreferredtoasªZiv-Lempelcoding,º orLZcoding,aftertwoIsraeliprofessorswhopublishedseveralimportantpapersinthe1970s and1980saboutthiskindofcompression.Itisveryeffectivebecauseitadaptstowhatever sortofdataisbeingcodedÐitisjustassuitableforSpanish,orevenJapanesewhichusesa completelydifferentalphabet,asitisforEnglish.Itevenadaptstothesubjectofthetext,since anywordthatisusedmorethanoncecanbecodedwithapointer.LZcodingwilltypicallyhalve thesizeofthedatabeingcompressed.Itisusedinpopulararchivingprogramswithnameslike ZipandARC,andinªdiskdoublingºsystems.Itisalsousedinhigh-speedmodems,whichare devicesthatallowyoutointeractwithcomputersoverordinarytelephonelines.Hereitreduces theamountofdatathatneedstobetransmittedoverthephoneline,noticeablyincreasingthe apparentspeedoftransmission. Anotherclassofcompressionmethodsisbasedontheideathatfrequentlyoccuringletters shouldhaveshortercodesthanrareones(Morsecodeusesthisidea.)Someofthebestmethods (whichtendtobeslower)usetheideathatyoucanhaveagoodguessatwhatthenextletterwill

Page30

ACTIVITY3.YOUCANSAYTHATAGAIN!ÐTEXTCOMPRESSION

beifyouknowthelastfewletters.WewillencounterthisprincipleinActivity5.

Furtherreading

AcomprehensiveintroductiontocompressionmethodscanbefoundinthebooksTextcom- pressionbyBell,ClearyandWitten,andManagingGigabytes:Compressingandindexingdoc- umentsandimagesbyWitten,MoffatandBellÐalthoughtheseareaimedatuniversity-level computersciencestudentsratherthanlaypeople.Ifyouareinterestedincomputerprogram- ming,youwillenjoyMarkNelson'sThedatacompressionbook,whichisapractically-oriented guidetothesubject.Dewdney'sTuringOmnibusdiscussesatechniquecalledªHuffmancod- ingºinasectionabouttextcompression.

Page31

Instructions:Fillineachblankboxbyfollowingthearrowattachedtotheboxandcopyingthelettersintheboxthatitpointsto.

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Page32

Activity4

CardflipmagicÐErrordetectionand

correction

AgegroupMiddleelementaryandup.

AbilitiesassumedRequirescountingandrecognitionof(small)oddand evennumbers.Childrenwillgetmoreoutofitifthey havelearnedbinarynumberrepresentation(seeActiv- ity1,CounttheDots).

TimeAbout30minutes.

SizeofgroupFromindividualstothewholeclass.

Focus

Oddandevennumbers.

Patterns.

Magictricks.

Summary

Whendataistransmittedfromonecomputertoanother,weusuallyassumethatitgets throughcorrectly.Butsometimesthingsgowrongandthedataischangedaccidentally. Thisactivityusesamagictricktoshowhowtodetectwhendatahasbeencorrupted,and tocorrectit.

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Page33

ACTIVITY4.CARDFLIPMAGICÐERRORDETECTIONANDCORRECTION

Technicalterms

Errordetectingcodes,errorcorrectingcodes,parity.

Materials

Eachpairofchildrenwillneed:

apileofapproximately25identicalcards,asdescribedbelow.

Todemonstratetolargergroupsyouwillneed:

asetofabout40cardswithmagnetsonthem,andametalboardforthedemonstration.

Whattodo

Thisactivityispresentedintheformofteachingthechildrenaªmagicºtrick.Theirinterestis easilygainedby®rstperformingthetrick,andthenofferingtoshowthemhowtodoit.Aswith anymagictrick,acertainamountofdramaishelpfulinmakingthepresentationeffective.The childrenwillneedtobesittingwheretheycanseeyou. Thetrickrequiresapileofidentical,two-sidedcards.Forexample,thecardscouldbered ononesideandwhiteontheother.Aneasywaytomakethemistocutupalargesheetof cardboardthatiscoloredononesideonly.Apackofplayingcardsisalsosuitable. Forthedemonstrationitiseasiestifyouhaveasetofcardsthathavemagnetsonthem.Itis possibletobuystripsofmagneticmaterialwithapeel-offstickyback,andtheseareideal.Make aboutfortycards,halfwithamagnetonthefrontandhalfwithoneontheback.Alternatively, fridgemagnetscanbeused;gluethembacktobackinpairs,andpaintoneside.Youcanthen laythecardsoutverticallyonametalboard(e.g.awhiteboard),whichiseasyfortheclassto see.Whenthechildrencometodothetricktheycanlaythecardsoutonthe¯oorinfrontof them.

1.Haveoneortwochildrenlayoutthecardsforyouonthemagneticboard,inarectangular

shape.Anysizerectangleissuitable,butabout®veby®vecardsisgood.(Thelargerthe layout,themoreimpressivethetrick.)Thechildrencandeciderandomlywhichwayup toplaceeachcard.Figure4.1showsanexampleofa®veby®verandomlayout.

2.Casuallyaddanotherrowandcolumntothelayoutªjusttomakeitabitharderº(Fig-

ure4.2).Ofcourse,thesecardsarethekeytothetrick.Thestrategyistochoosetheextra cardstoensurethatthereisanevennumberofcoloredcardsineachrowandcolumn(this isexplainedinmoredetailbelow).

3.Selectachild,andwhileyoucoveryoureyesandlookaway,havethechildswapacardÐ

justonecardÐforoneoftheoppositecolor(theyonlyneedto¯ipitoverifitisonthe ¯oor).Forexample,inFigure4.3,thethirdcardinthefourthrowhasbeen¯ipped.You

Page34

ACTIVITY4.CARDFLIPMAGICÐERRORDETECTIONANDCORRECTION Figure4.1:Aninitialrandom®veby®velayoutofcards

Figure4.2:Thecardswithanextrarowandcolumnadded

Page35

ACTIVITY4.CARDFLIPMAGICÐERRORDETECTIONANDCORRECTION

Figure4.3:Onecardhasbeen¯ipped

thenuncoveryoureyes,studythecards,andidentifywhichonewas¯ipped.Because ofthewaythecardsweresetup,therowandcolumncontainingthechangedcardwill nowhaveanoddnumberofcoloredcards,whichquicklyidenti®estheoffendingcard. Flipthecardback,andhaveacouplemorechildrenchooseacardto¯ip.Childrenwill likelybequiteimpressedwithyourabilitytorepeatedly®ndthe¯ippedcard.Thetrick workswithanynumberofcards,andisparticularlyimpressiveifalotofcardsareused, althoughitisimportanttorehearsethetrickinthiscase.

4.Havethechildrentrytoguesshowthetrickisdone.Thisisagoodexerciseinreasoning,

andalsohelpstoestablishthatthemethodisnotobvious.

5.Atthispointyouoffertoteachthetricktothechildren.Wehaveyettoseethisoffer

refused! Itishelpfultohavethechildrenworkinpairs.Geteachpairtolayouttheirowncardsin afourbyfoursquare,choosingrandomlywhethereachcardisshowingcoloredorwhite. Checkthatchildrencanremembertheconceptofoddandevennumbers,andthatthey appreciatethatzeroisanevennumber.Thengetthemtoadda®fthcardtoeachrowand column,makingsurethatthenumberofcoloredcardsiseven(ifitisalreadyeventhen theextracardshouldbewhite,otherwiseitshouldbecolored).Thetechnicalnamefor theextracardisaparitycard,anditcanbehelpfultoteachthechildrenthetermatthis point. Pointoutwhathappensifacardis¯ippedÐtherowandcolumnofthe¯ippedcard willhaveanoddnumberofcoloredcards,andsothe¯ippedcardistheonewherethe offendingrowandcolumnintersect.Eachmemberofapaircannowtaketurnsatdoing theªtrick.º Oncetheyarecomfortablewiththetricktheymaywishtogettogetherwithanotherpair andmakeupalargerrectangleofcards.Youmighteventrypoolingallthechildren's cardstogethertomakeonehugesquare.

Page36

ACTIVITY4.CARDFLIPMAGICÐERRORDETECTIONANDCORRECTION

Variationsandextensions

Insteadofcards,youcanusejustaboutanyobjectathandthathastwoªstates.ºForexample, youcouldusecoins(headsortails),sticks(pointingleft-rightorup-down),orcups(upside- downorright-way-up).Iftheactivityistoberelatedtobinaryrepresentation(Activity1),the cardscouldhaveazeroononesideandaoneontheother.Thismakesiteasiertoexplainthe widersigni®canceoftheexerciseÐthatthecardsrepresentamessageinbinary,towhichparity bitsareaddedtoprotectthemessagefromerrors. Therearelotsofotherthingsthatchildrencandiscoverbyexperimentingwiththecards. Getthemtothinkaboutwhathappensiftwocardsare¯ipped.Inthiscaseitisnotpossible todetermineexactlywhichtwocardswere¯ipped,althoughitisalwayspossibletotellthat somethinghasbeenchanged.Dependingonwherethecardsareinrelationtoeachother,it canbepossibletonarrowitdowntooneoftwopairsofcards.Asimilarthinghappenswith threecard¯ips:youcanalwaystellthatthepatternhasbeenchanged,butit'snotpossibleto determineexactlywhichcardshavebeen¯ipped.Withfour¯ipsitispossiblethatalltheparity bitswillbecorrectafterwards,andsotheerrorcouldgoundetected. Anotherinterestingexerciseistoconsiderthelowerright-handcard.Ifyouchooseittobe thecorrectoneforthecolumnabove,thenwillitbecorrectfortherowtoitsleft?(Theanswer isyes,whichisfortunateasitsaveshavingtorememberwhetheritappliestotheroworthe column.Childrencanprobablyªproveºthistothemselvesbytryingto®ndacounter-example.) ThedescriptionaboveusesevenparityÐitrequiresanevennumberofcoloredcards.It isalsopossibletouseoddparity,whereeachrowandcolumnhasanoddnumberofcolored cards.However,thelowerright-handcardonlyworksoutthesameforitsrowandcolumnif thenumberofrowsandcolumnsofthelayoutareeitherbothoddorbotheven.Forexample,a

5by9layoutora12by4layoutwillworkout®ne,buta3by4layoutwon't.Childrencould

beaskedtoexperimentwithoddparityandseeiftheycandiscoverwhatishappeningtothe cornerbit. AneverydayuseofarelatedkindoferrorcheckingoccursintheInternationalStandard BookNumber(ISBN)giventopublishedbooks.Thisisaten-digitcode,usuallyfoundonthe backcoverofabook,thatuniquelyidenti®esit.The®nal(tenth)digitisnotpartofthebook identi®cation,butisacheckdigit,liketheparitybitsintheexercise.Itcanbeusedtodetermine ifamistakehasbeenmadeinthenumber.Forexample,ifyouorderabookusingitsISBNand getoneofthedigitswrong,thiscanbedeterminedusingonlythechecksum,sothatyoudon't endupwaitingforthewrongbook. Thechecksumiscalculatedusingsomestraightforwardarithmetic.Youmultiplythe®rst digitbyten,thesecondbynine,thethirdbyeight,andsoon,downtotheninthdigitmultiplied bytwo.Eachofthesevaluesisthenaddedtogethertoformavaluewhichwewillcalls.For example,theISBN0-13-911991-4givesavalue s=(010)+(19)+(38)+(97)+(16)+(15)+(94)+(93)+(12)=172: Youthentaketheremainderafterdividingsby11,whichis7fortheexample.Ifthe remainderiszerothenthechecksumiszero,otherwisesubtracttheremainderfrom11toget thechecksum.Fortheexample,thechecksum(attheendoftheISBN),istherefore117=4.

Page37

ACTIVITY4.CARDFLIPMAGICÐERRORDETECTIONANDCORRECTION

Figure4.4:Abarcode(UPC)fromagroceryitem

IfthelastdigitoftheISBNwasn'tafourthenwewouldknowthatamistakehadbeenmade somewhere. Withthisformulaforachecksumitispossibletocomeupwiththevalue10,whichrequires morethanonedigit.ThisissolvedinanISBNbyusingthecharacterXforachecksumof10. Itisn'ttoohardto®ndabookwithanXforthechecksumÐoneinevery11shouldhaveit. HavethechildrentrytochecksomerealISBNchecksums.Nowgetthemtoseeiftheycan detectwhetheroneofthefollowingcommonerrorshasbeenmadeinanumber: adigithasitsvaluechanged; twoadjacentdigitsareswappedwitheachother; adigitisinsertedinthenumber;and adigitisremovedfromthenumber. Havethechildrenthinkaboutwhatsortoferrorscouldoccurwithoutbeingdetected.For example,ifonedigitincreasesandanotherdecreasesthenthesummightstillbethesame. Asimilarkindofcheckdigit(usingadifferentformula)isusedonbarcodes(universal productcodesorUPCs)suchasthosefoundongroceryitems(Figure4.4).Ifabarcodeis misread,the®naldigitislikelytobedifferentfromitscalculatedvalue,inwhichcasethe scannerbeepsandthecheckoutoperatormustre-scanthecode.

What'sitallabout?

Imaginethatyouaredepositing$10cashintoyourbankaccount.Thetellertypesintheamount ofthedeposit,anditissenttoacentralcomputertobeaddedtoyourbalance.Butsuppose someinterferenceoccursonthelinewhiletheamountisbeingsent,andthecodefor$10is changedto$1,000.Noproblemifyouarethecustomer,butclearlyitisinthebank'sinterestto makesurethatthemessagegetsthroughcorrectly! Thisisjustoneexampleofwhereitisimportanttodetecterrorsintransmitteddata.Just aboutanywherethatdataistransmittedbetweencomputers,itiscrucialtomakesurethata receivingcomputercancheckthattheincomingdatahasnotbeencorruptedbysomesortof electricalinterferenceontheline.Thetransmissionmightbethedetailsofa®nancialtrans- action,afaxofadocument,someelectronicmail,ora®leofinformation.Andit'snotjust transmitteddatathatweareconcernedabout:anothersituationwhereitisimportanttoensure

Page38

ACTIVITY4.CARDFLIPMAGICÐERRORDETECTIONANDCORRECTION thatdatahasnotbeencorruptediswhenitisreadbackfromadiskortape.Datastoredonthis sortofmediumcanbechangedbyexposuretomagneticorelectricalradiation,byheat,orby physicaldamage.Inthissituation,notonlydowewanttoknowifanerrorhasoccurred,butif possiblewewanttobeabletoreconstructtheoriginaldataÐunlikethetransmissionsituation, wecan'taskforcorrupteddiskdatatobere-sent!Anothersituationwhereretransmissionisnot feasibleiswhendataisreceivedfromadeepspaceprobe.Itcantakemanyminutes,evenhours, fordatatocomeinfromaremoteprobe,anditwouldbeverytedioustowaitforretransmission ifanerroroccurred.Oftenitisnotevenpossibletoretransmitthedata,sincespaceprobes generallydon'thaveenoughmemorytostoreimagesforlongperiods. Peoplehavecometoexpectthatwhentheystoreadocumentontheirwordprocessor,or sendamessagebyelectronicmail,theywon't®ndtheoccasionalcharacterchanged.Sometimes majorerrorshappen,aswhenawholediskgetswipedout,butveryminorerrorsjustdon'tseem tooccur.Thereasonisthatcomputerstorageandtransmissionsystemsusetechniquesthat ensurethatdatacanberetrievedaccurately. Beingabletorecognizewhenthedatahasbeencorruptediscallederrordetection.Being abletoreconstructtheoriginaldataiscallederrorcorrection.Asimplewaytoachieveerror detectionandcorrectionistotransmitthesamedatathreetimes.Ifanerroroccursthenone copywillbedifferentfromtheothertwo,andsoweknowtodiscardit...ordowe?Whatif, bychance,twoofthecopieshappentobecorruptedinthesameway?What'smore,thesystem isveryinef®cientbecausewehavetostoreorsendthreetimesasmuchdataasbefore.Allerror controlsystemsrequiresomesortofadditionaldatatobeaddedtoouroriginaldata,butwecan dobetterthanthecrudesystemjustdescribed. Allcomputerdataisstoredandtransmittedassequencesofzerosandones,calledbits,so thecruxoftheproblemistomakesurethatwecandeliverthesesequencesofbitsreliably.The ªcard¯ipºgameusesthetwosidesofacardtorepresentazerooronebitrespectively,andadds paritybitstodetecterrors.Thesametechniqueisusedoncomputers.Addingasingleparity bittoarowofbitswillallowustodetectwhetherasinglebithasbeenchanged.Byputting thebitsintoimaginaryrowsandcolumns(asinthegame),andaddingparitybitstoeachrow andcolumntoensurethatithasanevennumberofones,wecannotonlydetectifanerror hasoccurred,butwhereithasoccurred.Theoffendingbitischangedback,andsowehave performederrorcorrection. Inpracticecomputersoftenusemorecomplexerrorcontrolsystemsthatareabletodetect andcorrectmultipleerrors.Nevertheless,theyarecloselyrelatedtotheparityscheme.Even withthebesterrorcontrolsystemstherewillalwaysbeatinychancethatanerrorgoesunde- tected,butitcanbemadesoremotethatitislesslikelythanthechanceofamonkeyhitting randomkeysonatypewriterproducingthecompleteworksofShakespeare. Andto®nish,ajokethatisbetterappreciatedafterdoingthisactivity: Q:Whatdoyoucallthis:ªPiecesofnine,piecesofnineº?

A:Aparrotyerror.

Page39

ACTIVITY4.CARDFLIPMAGICÐERRORDETECTIONANDCORRECTION

Furtherreading

Theparitymethodoferrordetectionisrelativelycrude,andtherearemanyothermethods aroundthathavebetterproperties.SomeofthemoreimportantideasinerrorcodingareHam- mingdistances,CRC(cyclicredundancycheck),BCH(Bose-Chaudhuri-Hocquenghem)codes, Reed-SolomonCodes,andconvolutionalcodes.Detailsaboutthesesortsofcodescanbefound inRichardHamming'sbookCodingandInformationTheory,andBenjaminArazi'sAcom- monsenseapproachtothetheoryoferrorcorrectingcodes.TheISBNofHamming'sbookis

0-13-139139-9,aninterestingnumberforabookaboutcoding.Lesscomprehensive,butmore

accessible,informationabouterrorcorrectioncanbefoundinTheTuringOmnibusbyDewdney, andinComputerScience:AnOverviewbyBrookshear.

Page40

Activity5

TwentyguessesÐInformationtheory

AgegroupCanbesimpli®edtosuitmiddleelementaryandup. AbilitiesassumedComparingnumbersandworkingwithrangesofnum- bers.

Time20to30minutes.

SizeofgroupFromtwopeopletothewholeclass.

Focus

Deduction.

Rangesofnumbers.

Askingquestions.

Summary

Computerscienceisverymuchconcernedwithinformation.Computersystemsstore information,retrieveit,analyzeit,summarizeit,andexchangeitwithothercomputers. Sinceinformationissofundamentaltothesubject,itisimportanttoknowhowtoquantify it.Informationtheoryprovidesawayofmeasuringinformation,andincludeslawsthat de®nelimitsonhowef®cientlyitcanbestoredortransmitted.Thisactivitystudiesan importantmethodofmeasuringinformationcontent.

From"ComputerScienceUnplugged"

c

Bell,Witten,andFellows,1998Page41

ACTIVITY5.TWENTYGUESSESÐINFORMATIONTHEORY

Technicalterms

Informationtheory;Shannontheory;coding;datacompression;errordetectionandcor- rection;entropy.

Materials

Youwillneed:

awritingsurface,suchasblackboardandchalk,and cardswithanswerstoquestionswrittenonthem(showninTable5.1),asdescribedbelow.

Whattodo

1.Haveadiscussionwiththechildrenaboutinformation.Askfortheirde®nitionofin-

formation.Askthemhowwemightmeasurehowmuchinformationthereisin,say,a book.Theymightsuggestthenumberofpages,orthenumberofwords.Butwhatifitis aparticularlyboringbook,orparticularlyinterestingÐdoesonehavemoreinformation thantheother?WhatifthebookcontainednothingbutthephraseªBlahblahblahºre- peatedoverandover?Would400pagesofthatcontainmoreinformationthana400page telephonedirectory? Itsoonbecomesapparentthatalthoughwehaveanintuitivenotionofinformationcontent, itishardtoquantify.Explaintothegroupthatcomputerscientistsmeasureinformationby howsurprisingamessage(orbook!)is.TellingyousomethingthatyouknowalreadyÐ forexample,whenafriendwhoalwayswalkstoschoolsays
Politique de confidentialité -Privacy policy