Thiswasnotcleartomewhen I firstwasabletostudycomputersciencewaybackinhighschool.
Eveninlastquail a secondary.
I didnotstudycomputersciencebecause I thoughtitwasonlyaboutprogramming, anditseemedveryantisocial, andeveryone's headsweredowninthecomputerlab, andtheyseemedveryfocusedonlyonthekeyboard.
Butreally, itwasn't untilcollegewhen I took a coursecalledCS 50 that I discoveredthatitreallyismoregenerallyaboutproblemsolving.
Andit's kindoffunnythat I justcountedthetwoingredientstothisproblem.
HowmightwerepresentinformationIfwe'rejustcountinginformation, thenumberofpeopleintheroomwill 12345 Or I couldcounthighercertainlyif I usedhashmarksone, 23456 andsoforth.
Soevenifyoudidn't quitefollowtheexactpattern I wasdoing, itwasobviouslynotassimpleas 12345 I wasinsteadkindofpermutingthemindifferentwaysbyraisingandloweringthem, therebymaking a patternoutofthem.
If I startedzeroand I gouptoallfive, there's 32 total.
Butifthisiszeroandthisisallup, thenif I'vegot 32 possibilities, I cancountfrom 0 to 31 itturnsout, butmoreonthatinjust a littlebit, sothat's a lot.
Andthatsuggeststhatwith a littlebitmorethoughtsand a littlebitmoreclevernessastohow a computerscientistrepresentsinformation, youcanpack a lotmoreinformationintoverylimitedspace.
Andsohowperfectisitthatthere's a waytorepresentinformationbyeitherputting a fingerdownoruporoff, oronthatistwodifferentstatesbecauseyoucanrepresenttwostatesreallyeasily.
Howwouldwerepresentthenumberwehumansknowindecimalasone 001001 Andthisiswhereitmightget a littletrickyfor a moment.
Howabouttwo?
Yeah, 010 AndthisiswhereNowweseetheconnectiontowhat I wasdoingwithmyfingers.
I didn't go 012 Thesecondtime, I went 012 therebychangingmyfingerfromlike a 1 to 0 andzeroto a onetogivemethispatternandOfcourse, ifyouwanttorepresentthree, it's gonnabeYeah, 011 Andnow, howaboutseven?
Andsolet's actuallydivedownintowhat's insideof a computersuchthatyoucanactuallyrepresentthenumbersevenoreightoranythinginbetweenusinganactualcomputer.
Well, turnsoutthatinsideof a computerareinsimpleform, justlikelotsoftinylittlelightbulbsor, morespecifically, littleswitchesthatcouldbeturnedonandoff.
Andthoseswitches, whenturnedonandoff, eitherallowyoutostore a littlebitofelectricitythatcamefromthewallorthebatteryorallowittodissipateandgoaway.
Sothoseswitchesaircalledtransistors.
Ifyou'veheardthetermtransistors, just a tinylittlemicroscopicswitchandCPusedthesedayscentralprocessingunits, thebrainsinsideof a computer, theintelinsidehardwarehasmillionsofthesetinylittleswitches.
Butforthemoment, I onlyhavethreeoftheseswitches.
Andso I claimthatthenumber I'm currentlyrepresentingwiththesethreelightbulbsiswhatnumberifthey'realloffzero.
Ifyouweretostudy a hardwareclassincomputerscienceandreallybecoming a collector, okay, electricalengineer, youwouldalsoexploretherealitythatwhenyouhaveanIntelCPU, Intelisinside.
It's a zerooroneifwejustagreethatallofthesecouldberepresented, yes, andswitchesintransistors, a zerosandones.
Well, let's justagreethatanytimeyou'rewritinganemailor a documentandyoutypetheletter a letthecomputerisjustgonnastorethenumberonewithsomesequenceoftransistorsandbethenumbertwoandsoforth.
Nowitturnsout, that's all.
Computerdoesindeedtostoretext, butforwhateverreason, humansdidnotchoosesimplenumberslike 123 Itturnsoutthatdecadesagohumansdecidedthattheletter A she'llbe 65 be.
She'llbe 66 seeShelby 67 soforth.
Andthere's othernumbersforthingslikepunctuationandforlowercaselettersand a fewothersymbolsyouwouldseeonthetypicalkeyboard.
Andthat, indeedis, asJaimenotes, is a systemcalledaskingHappenstobetheAmericanStandardCodeforInformationInterchangeandtheAmericanintheacronymThereisactuallyGermaine, becausewewere a littleselfish.
Inotherwords, I heard 1,000,000,000 soit's actuallyroughlyfourbillion.
Soif I had 32 lightbulbshere, whichdoesn't seemlike a crazyamount, I couldactuallypermutethoseswitchesonandoffindifferentpatternsinfourbilliondifferentways.
WhichistosayUnicodehas a lotofroomforanyandallcharacters.
Sowhataretheimplicationsofthis?
Well, let's justseehowthismightmap.
Soifthecapital A is 65 let's seehowwemightactuallylookatanactualwordinasking.
Sohere's Ah, quickcheatsheet.
That's a littlelongerthantheone I drewhere, a 65 iess 73 soforthsupposedthatyoureceived a textmessageoremail.
Supposethatthepatternofbitsyoureceivedhappentobe a bunchofzerosandonesthatifyoudooutthemathlikewedidoverhere, worksouttobethenumber 72.
Thenthenumber 73.
Yeah, soyou'd literallyjustgot a textmessageoranemailthatsays h I orhigh, Andthat's whysoyourcommphoneoryourcomputermighthavegotten, what, eightor 16 totalbitsthatwereonandoffintherightpatternstorepresentthedecimalnumber 72 or 73 AndyourphonebecauseitscontextsensitiveoryourlaptopBecauseitknowsyouhavethetextmessagingprogramopenoryouhaveyouremailprogramopen.
It's notgonnashowyouzerosandones.
It's notgonnashowyoudecimalnumbers, likein a calculatororspreadsheet.
It's gonnashowyouthecorrespondingaskingorUnicodeletters, whichis a tch, I question.
Butyou'd havetogoevenfurtherbecausethere's a lotofdarnemojisthesedays.
Yeah, lives.
I want a ceasetotwothatwasstrangelyprecise.
Butyes, perhaps, Andindeedifweactuallydothisindecimal, ifyoureceive a textmessagewith a facewithtearsofjoytoday, yourphoneor a laptophasjustreceivedliterally a patternofbitsthatrepresentsthenumber 128,514.
Why, justbecausethatonewasavailableandallofthoseothervariantsofSmiley's air a littlebiggerthanthisnumberand a littlesmaller, Whichjustmeansyouget a patternofbitsthatyourphoneoryourlaptopinterpretsasthatsmileyface.
Othersystems, ifyou'refamiliarwithMorsecode, donothavethisfeature, andsoyoucangetambiguouswordsoutofMorsecodebecausesometimes a dotonthedashmightactuallybe a dashand a dotin a differentcontext, dependingonwhereyouseparatethem.
Soitturnsoutthatcomputerstypicallyuseeightbits, whichagainis a multipleofeight, as I noted, torepresenthowmuchred, Howmuchgreen, howmuchblue, whichistosayeightpluseightplus 8 24 bitsaretypicallyusedtotaltorepresentcolorson a screen.
Soifthesmallestnumberyoucanrepresentwith a Pittsis, ofcourse, zeroright, allthelightbulbsareoff.
Butifyouweretoopenphotoshoporsomegraphicalprogramthatisinterpretedsupposedtoshowcolors, notletters, anyguessesastowhatyougetbycombininglike a mediumamountofred, a mediumamountofgreenandjust a littlebitofblueandagaintherangesfrom 0 to 2 55 Anyonewanttoguesswhatyougetwhenyoucombinethosecolors?
Ifit's a videofile, will a bite B Y t e isjusteightbits.
Why?
Well, onebitisgenerallyprettyuseless.
Youcanonlycountashighasone.
Sounitsofeightwerecommonthere, too.
Soeightbitsisonebite.
Onemegabyteisonemillionbites.
Whichistosaythatifyouhave a lotoftheselittledots, eachofwhichtakesupeightpluseightpluseightorthreebites, youcanliterallydooutthemathandfigureouthowbigyourphotographmightbe.
Okay, sosomeofthat I cananswertherestwillhavetowaitandsee.
Soforthosecubitiskindof a cutewordthatrefersto a bitinquantumcomputing.
Quantumcomputing, orcubits, essentiallyreferstoanenvisionedtechnologyonwhichresearchisbeingdone, wheretechnicallyyoucanhavein a devicelike a like a lightbulbthat's inboththeonandtheoffstateatthesametime.
Insomeweirdway, itreallyderivesfromphysics.
Andso, withcubits, youhavetheability, atfirstglancetostormorthanjust a singlebitofinformation.
Thisisdangerous, theoretically, because a lotoftheworld's securitythesedaysreliesoncryptography, theartofencryptingorscramblinginformation, and a lotofencryptionreliesontheperceiveddifficultyofsolvingcertainmathematicalproblemsquickly.
Forinstance, itisreallyhardtotake a reallybignumberandfactorit.
Youwanttosolveproblems, andthoseair, generallycalledalgorithmsanalgorithm, isjuststepbystepinstructionsforsolving a problem.
It's kindof a nicefancyword, butitreallyisjustthat.
It's like a listofcommandsorinstructionsthatyoufeedto a humanorto a robotorto a computer.
Sowhat's wasn't suchalgorithm?
Well, backintheday, welikeyouusethesthistechnologyhere, phonebooksinwhichyouhavelotsofnamesandnumbers, andthenamesarehopefullysortedfrom A to Z andthenumbersthenlineupwiththeindividualsnames.
Andsoif I wantedtolookup a friendorcolleaguesphonenumber, I couldjustlookupthatnumberandthencallthem.
So I don't knowwhy I'm explaininghow a phonebookworks, butit's verysimilartothistechnologynow.
123 ormaybe 246 If I startedwith, like, 1000 pagesinthisprettythickphonebook I justwentfrom 1000 toe 500 to 2 50 I'm reallytakingbigbitesoutofthisproblem.
Andif I justrepeatthatsamealgorithmagainandagain, I'llprobablybeleftultimatelywithjustonepagethatMikeiseitheronornot.
Itmighttakeme 700 stepstofindMikeSmithinthefirstalgorithm, butmyGod, like 10 stepsinthethirdalgorithmwiththesameinputsandoutputs.
Socomputersciencetoisallaboutjustkindofharnessing, frankly, ourhumanintuitionandexpressingourselves a littlemorecarefully, putting a littlemorethoughtintotheproblemandthengettingmuch, muchfasterormoreefficientresults.
Andsohowmightwethenquantifythisdifference?
Wedon't havetoeventalknumbersveryspecifically, butifthisisjust a chart, andhereisthesizeoftheproblem.
Sothisislike, numberofpages.
So a lotofpagesoverhere, a fewpagesoverhere, righttoeleft, verticalaccesstimetosolve.
Somaybezerosecondsand a lotofsecondscouldbeourunitofmeasure.
It's a straightline, butit's lowerbecauseifthephonebookhasthismanypages, thefirstalgorithmmighttakemethismoneysteps.
Buttheotheralgorithmwhere I'm goingtopagesat a timetakeshalfassedmanysteps, sothelineisthesameshape, butit's justloweronthechart.
Thethirdalgorithm, though, isfundamentallybetter, andit's a logarrhythmiccurve, ifyouwill, andevenif a littlerustyonwhat a lagerofthemis, it's a curvethatlookslikethis.
Butyoucanalsomakemoretheoreticallysoundargumentsandsay, Well, ouralgorithmisfundamentallybetterthanyoursbecauselook, as n getslargewere, andit's justthenumberofpagesinthephonebook.
AndhereishowwemightwritethepseudocodeforthatalgorithmtofindMikeSmith, where I dividedandconquered.
Stepzerowaspickupthephonebook.
Stepone, Opentothemiddleofthephonebook.
Steptwo.
Well, lookatthenamesandthen I make a decision.
IfSmithisamongthenamesthat I'm lookingat, then I'm gonnagoaheadandcallMike.
Butthat's nottheonlypossibility.
ItmightbethecasethatExcuseme.
Smithisearlierinthebook, inwhichcase I shouldopentothemiddleofthelefthalfofthebookandthen, frankly, justgobacktoSteptwobecause I alreadyhavethesamelogicreadytogoelse.
Well, inlanguageslikeJavaand C plusplusandothers, youseecommonality.
Sothisisjustpseudocode, buteverything I'vehighlightedinyellowherein a properprogramminglanguagelikepythonisgonnabecalledanahfunction, and a functionisjustlike a verb, anactionthattheprogramortherobotorthehumancontagion.
It's like a forkintheroad, andyouhavetodecidewhichbranchtogodownthesethings a littlemoretechnicallyorcalledbooleanexpressionsafter a mathematiciannamedBulland a Booleanexpressionisjust a questionthathas a yesornoansweror a trueorfalseansweror, moresimply, a oneorzeroansweronesandzerosairjustreallynicewhenyouwanttorepresenttwoopposingideas, trueandfalse, yesornoorsomeotheridea.
So a Booleanexpressionisjustgoingtosayyesorno.
SoSmithislaterinthebook.
It's a questionorSmithearlierinthebook, also a question, andthen, lastly, wehavethishowmuchyoudescribethisyellowfeature.