资源描述:
《人事请假系统》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、AdvanceDataStructureReviewofChapter1張啟中Chapter1BasicConcepts1.1Overview:SystemLifeCycle1.2AlgorithmSpecification1.3DataAbstraction(Chapter2)1.4PerformanceAnalysisandMeasurementSystemLifeCycleRequirementsAnalysisDesignRefinement&CodingVerificationExample人事請假系統帳號和
2、密碼驗證子系統請假處理子系統審核驗證子系統統計考核子系統Top-downBottom-upAlgorithmSpecification演算法是由一序列的指令所組成。依序執行這些指令可以解決給定的問題。演算法具有下列五大條件:輸入(Input)外界可提供零個或多個輸入資料。輸出(Output)必須最少有一個輸出的結果。明確性(Definiteness)每一個指令的功能都必須明確而不混淆。有限性(Finiteness)對任意的輸入資料,演算法必須在有限的時間內執行完成。有效性(Effectiveness)每一個指令必須非常基
3、本:僅用紙筆即可完成。AlgorithmDescribingNaturallanguageEnglish,ChineseInstructionsmustbedefiniteandeffectivenessGraphicrepresentationFlowchartworkwellonlyifthealgorithmissmallandsimplePseudolanguageReadableInstructionsmustbedefiniteandeffectivenessCombiningEnglishandCInthi
4、stext可整除91Example問題:設計一個演算法來測試一個正數n是否為質數。作法:逐一檢查2,3,...,n-1是否可以整除n;若都無法整除,則n是質數,否則不是質數。範例:91是否為質數?2,3,4,5,6,7,8,......,76範例:7是否為質數?2,3,4,5,61.若n小於或等於1,則n不是質數;2.令k=2,3,......,n-1,逐一檢驗:3.若k可以整除n,則n不是質數;4.若以上所有的k值均無法整除n,則n是質數;輸入一個自然數n。輸出回答n是/否為質數。明確性每一行指令都很明確。有限性對任一
5、個輸入的自然數n,此演算法都能在有限的時間內求出n是否為質數。有效性每一行指令都簡易至光用紙筆即可做出的程度。ExamplePerformanceAnalysisandMeasurementCriteriaIsitcorrect?Isitreadable?…PerformanceAnalysis(machineindependent)Spacecomplexity:storagerequirementTimecomplexity:computingtimePerformanceMeasurement(machinedep
6、endent)PerformanceAnalysis:SpacecomplexityS(P)=C+SP(I)FixedSpaceRequirements(C)Independentofthecharacteristicsoftheinputsandoutputsinstructionspacespaceforsimplevariables,fixed-sizestructuredvariable,constantsVariableSpaceRequirements(SP(I))dependontheinstancec
7、haracteristicInumber,size,valuesofinputsandoutputsassociatedwithIrecursivestackspace,formalparameters,localvariables,returnaddressExample*Program1.9:Simplearithmeticfunction(p.19)floatabc(floata,floatb,floatc){returna+b+b*c+(a+b-c)/(a+b)+4.00;}*Program1.10:Ite
8、rativefunctionforsummingalistofnumbers(p.20)floatsum(floatlist[],intn){floattempsum=0;inti;for(i=0;i