Andthenwe'regonnabestartinguptosomethingcalledtheBig O soreallyquicklywe'regonnabedoingthisallintheJupiternotebook, primarilybecauseit's notthatdifficultenoughthatwehavetousepicharm.
Andit's also a littlebitcleanerlooking.
So I analyzedalgorithmsinthefirstplacewhenalgorithmdon't getneverspoke a word.
Thetwoavenues I mentionedbeforethatwecoulddothefourismemory, whichisspaceallocationwithinthecomputerorthetimetorunthatmuchtimeit's gonnataketoactuallyrunthatsoftware.
Butthere's onlyoneassignmentthat's necessarilygoingonwithinthisand a finalfirstassignmentiszeroandtheMetassignmentsgonnakeepchangingbasedonanorderofend.
Soatleastthisway I couldknowitdoesn't matterthesystem.
If I havetwodifferentalgorithms, I cantellyouthatonealgorithmisgoingtohavesomeelementoftime, andthisotheralgorithmisgoingtohave a comparativelydifferentrelativeamountoftime.
Soifyourfunctionhas a big o ofoneor a bigoldlogof N whichisstillgonnabequiteLennierAh, youcanseethatourperformancehereasendgrowsendsgettingbigger, bigger, bigger, bigger, bigger, bigger.
Andthisistthe e theoperations, theamountofoperationwouldbeperformed.
Youcanseethatwe'reintheexcellentrangehere.
Excellentandgoodrangeforthoseparticularbig O's.
Butthenoncewestarttogettothisisoverthefunctionofend, whichisverymuchlikeourouroriginalfunctionthatwedidsomeoneyoucanseewe'reanaffairfrom a performancestandpointisandgrows.
WheredoesitfallintermsofthebigOh, thisis a morebrokendownversionoftheBig O, showingheronelakhofLockeandLockeoutandsoon, soforthgoingandwhattheiractualfrank, functionalnameisgonnabecalled.
Ifyouwereeverdescribingit, okay, what I havehere.
Thiscode I'm notgonnagothroughperse.
I'm justusingthisfromdemonstrationpurpose.
Butmoreimportant, logimportingdump.
I importedmyplotlive.
I'm gonnahavemypuppetinline.
Whatyou'regonnaseein a momentSettinguprun, 10 comparisons.
What?
We'redoingthis.
We'reusingnumbpietocreate a linespace 1 to 10 andthenwe'regiving a differentlabels.
Thisis a biggoalofone, andConstanceisrememberfromthechartfromyesterdayhaveoneofthelowestcomputationintensiveimpactson a computersystemintermsofperformance.
Soscalability, thisisnothing.
Thisiseasyasballs.
Youcouldscalethisasmuchasyouwant.
We'reonlygrabbingthefirstindexposition.
Sonowwe'regonnamoveonThioandBig O event, whichiscourseisgoingtobelinear.
ZondaConstanceLinearseleniaisslightlyaboveintermsofwerestillingoodperformanceon a big O performancechart.
Esoregardlessofend, westillcouldgetfair, computationalintensiveoutofthesystem, sohewould'vefinalfunction, andwe'regonnaput a listthroughthere.
SowehavefourValandList.
Sothat's gonnabeforeourvaluesinthelist.
Wewanttoprintthevaluessoitdoesn't matterwhat I listisgonnabe a It's simplygonnaprintthis.
Thatmeans a totalperformanceandtimesandassignments, airandsquared.
Soifwehavethreeassignments, showyou.
Soifweonlyhaveherewehavesix, soweshouldhave 36.
Soifyoucountedthisdown 1 to 2 hopesyoushouldhave 36.
Let's keepthislittleshortersoit's easiertosee.
Soifwehavethreeelements, weshouldhave 9123456789 Sothat's ourendtimes N O R N squaredWhateverendisgonnabe n squaredintermsofcomputationalintensiveforthatparticularsystem.
Howmanyoperationsairwayactuallyperformingorperformingthisandoperationsforanoperationsin a loopofloopson, butsaysyoucouldseehowverydangerousisgonnabeforlarge, verylargeimportsiswhybig, oh, soimportanttobeawareofwhenyou'recreatingsoftware.
Hencetheinputofthreeguys.
Nineoutputs.
That's what I justshowedabove.
Wehavenineoutputsforah, intheendofthreecalculatingscaleofbigohsoinsignificanttermsdropoutofthebig O notationAndthisisexactlywhatwesawyesterdaywhenwedid, uh, herewegointermsoftheseaircalledinsignificantterms.
That 45 20 the 19.
Butyou'realwaysgonnagoon a backwardsorder, meaningthatthelowesttermisgonnabethe 19.
You'd betechnicallycorrecttosaythisis a big 03 totheend, asandgrowsyouarecompetitiontestisgoingtobethreetimesthatin, However, asthenbecomesinfinitivethreebecomesinconsequentialbecomesaninsignificantconstant.
Aswe'rescalingup, you'regoingtoseehowthenumberoneinthenumber 10 aregonnaquicklymeanabsolutelynothingtoouroverallanswerforcomputationalintensiveon a big O.
It's importanttokeepinmindthatthereis a worstcaseinthebestcasescenarioandtheycannotverycompletelydifferentbigoldtimes.
Theyshouldhaveverycompletedifferentbigoldtimes.
Sowe'regonnadohereiswe'regonnaquit a bestcasescenarioforstuff, So I'm gonnacreate a functionwe'regonnacallmatchyourit's gonnatake a list, andit's gonnatake a match.
Thisisgonnacome a spacecomplexity, andwehave a bigoldoneforspacecomplexbecausememoryis a constantmeaningthatit's notprinting, it's notcreating 10 versionsofthis.
Sointhisparticularcode, ifyouweredealingwith a largerpieceofcodeandyouhadtime, complexitiesofspacecomplexitiesandifyouhad a spacecomplexityofbigoldwithone a timecomplexityofbigoutoftheend, ifyouhadtomanipulatesomeaspectofthecodeordestroysomethingyou'd ratherdofrom a spacecomplexitystandpoint, becausethecomputationalintensiveofthatfromthebig o of a constantismuchlowerintermsofscalabilityintermsoflimitsthanthetimecomplexityofbig o N.
Becausethis, eventhoughit's stilllinear, thisisgonnagrowin a much, muchfastergrowthrateintermsofcomputationalintensivethanthespacecomplexityof a constantwould.
Nowagain, I don't expectallofthistositwithinthefirsttimethatwe'redoingthis.
SoinpythonwithraysequencesorthreedifferenttypesofRay's, youcouldhave a listtoRayatopullonthestring.
Nowthesearealldifferent.
Threetypesof a raise.
Youcanseethatthelistisgoingtobeidentifiedbythebracketstopullparentheseswith a commonbetweenthem, andthen a stringisidentifiedinbetweenparentheseswiththequotations.