Вы находитесь на странице: 1из 2

LynDao

ElectronicComputerScience
HandshakeandFencePostActivity

HandshakeProblem#1

Problem:
Assumethereare20peopleinaroom,includingyou.Youmustshakehandswith
everyoneelseintheroom.Howmanyhandswillyoushake?IfthereareN(whereN>0)people
intheroom,howmanyhandswillyoushake?
a. Youknowthatthereareatotalof20people.Allhandsneedtobeshaken,therefore,the
startingfunctionisN>0.
b. Seeingashoweachpersonwillonlyshakewithonearm,itcanbeconcludedthatthere
willbeatotalof1handshakeperperson.
c. 1multipliedby20=20.N=N1
d. Ifyouretoshakehandswith19people,20peopleincludingyourself,thenthatmeans20
handshakeswilltakeplace.However,yourenotsupposetoshakehandswithyourself.
Thisnumbercomestoatotalof19peopleshandsthatyoushook.

FencePostProblem

Problem:
Youneedtobuildonesideofafencethatis12yardslong.Thisfencewillbebuilt
withfencepostsandrailsthatconnectonefenceposttoanother.Ifeachfencepostis1yard
awayfromthenextfencepost,howmanyfencepostswillbeneededforthissideofthefence?
HowmanyfencepostswillbeneededforasideofafencethatisN(whereN>0)yardslong?
a. Youreawarethatthetotallengthofthesideofthefenceis12yards.Eachpostisexactly
1yardawayfromeachother.ThecommencingfunctionwouldbeN>0
b. Thetotalnumberofyardscanbedividedbythedistancebetweentheposts.Thiswill
revealthenumberofpoststhatwillbenecessitated.
c. Takethetotalnumbersofyards(12),anddivideitby1,thedistancebetweenthepost.
Thenweaddonetothequotient,whichmarkstheending.12/1+1=13N/1+1=Number
ofposts.
d. Ifeachpostisoneyardaway,12yardsawayisequivalenttothedistancebetweenthe12
posts.Youcanthinkpostasanotherwordforyard,becauseeachpost=1yard.However,
youneedtorememberthatthepostsstartofatthebeginningofeachyard,andmustend
thetheyards.Soyouaddoneadditionalpost.

HandshakeProblem#2

Problem:
Assumethereare10peopleinaroom,includingyou.Eachpersonintheroommust
shakehandsonetime,andonlyonetime,withalltheotherpeopleintheroom.Howmany
handshakeswilloccur?Ifthereare20peopleintheroom,howmanyhandshakeswilloccur?If
thereareN(whereN>0)peopleintheroom,howmanyhandshakeswilloccur?
a. Itisknownthatthereareatotalof10people.Eachpersonshakesotherperson'shand
once.ThebeginningfunctionisN>0
b. Wecantakethenumberofhandsonepersonwouldshake,thensubtract1fromthat
number.Wewouldcontinuetosubtract1fromeachnumberforasmanypeopleasthere
are,consideringyoudontwanttotakeyourselfintoconsideration.
c. Eachpersonshakes9hands.ThatisN=n1.Wesubtractonebecausewewillnotinclude
ourselvesinthecount.Then,wetake10thetotalnumberofpeople,10,andwesubtract
thenumberofhandshakesby1,anddothattentimes,foreachperson.Thetotalnumber
ofhandsshookis45.S=((n1)+(S1)repeated9moretimes.Thealgorithmisabit
confusing,butwhenyouunderstandthatnrepresentsnumberoftotalpeople,andS
representstheshakes,thenwecansee,thatwhenweplug10inforn,thisthisishowthe
equationworksout.S=(101)+(91)+(81)+(71)+(61)+(51)andsoon..Whenweaddit
alltogetherweget45.
d. Ifwerunthisequationthroughthissamealgorithmfor20people,wewouldgetatotal
numberofhandsshakesof244.

Reflection:

Question:
Whyareproblemsliketheseimportanttolearnhowtosolve?Howcouldthistypeof
solutionbeofbenefittoacarpenter,achef,ateacher?
Theseproblemsareusefultoknowhowtosolvebecausetheyreapartofeveryday
routineswhereyouregoingtoneedtoknowhowyouregoingtocompleteafence,the
amountoftimeitsgoingtotaketoprepareameal,andhowtogradepaperswithina
certaintimeframe.Plus,knowinghowtosolvetheseproblemswouldhelpdevelopskills
thatwouldaidincomingupwithsolutionsforotherdilemmas.

Вам также может понравиться