1 / 46
文档名称:

数据结构与算法分析 2new.ppt

格式:ppt   大小:467KB   页数:46
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

数据结构与算法分析 2new.ppt

上传人:xxq93485240 2019/5/8 文件大小:467 KB

下载得到文件列表

数据结构与算法分析 2new.ppt

相关文档

文档介绍

文档介绍:(algorithm)南绪慷衔摇脂殃眠湘病坑鸦倘豌戮棚问涯祸贱戈忿撮涵干几摹数室伏末闭数据结构与算法分析2new数据结构与算法分析2newWeusetwoapproachestodetermineit: performanceanalysis plexity:plexity::instructionspacedataspace(spaceneededforconstants,ponentvariables)environmentstackspace(pletedfunctions):afixedpart—includespaceforinstructions,simplevariables,fixed-ponentvariables,constantsavariablepart—ponentvariables,dynamicalallocatedspace,recursionstackS(p)=c+Sp(instancecharacteristics))example:SequentialSearchpublicstaticintSequentialSearch(int[]a,intx){inti;for(i=0;i<&&a[i]!=x;i++);if(i==)return–1;returni;}:10bytes:x,i,a[i],0,-1,eachofthemcost2bytesS(n)=[0:n-1]publicstaticfloatRsum(float[]a,intn){if(n>0)returnRsum(a,n-1)+a[n-1];return0;}:formalparameters:a(2byte),n(2byte)returnaddress(2byte)Depthofrecursion:n+1SRsum(n)=6(n+1)(p)T(p)=compiletime+piletimedoesnotdependonthe instancecharacteristicsTheruntimeisdenotedbytp(instance characteristics)1)operationcounts henumberoftimestheseareperformed丈缨笋送抬洒糜邵丧淄旦奔拌膏栏树降正郎雀搐简课砚萤薄莎民雷冰散菜数据结构与算法分析2new数据结构与算法分析2new