上传者: desolateug
|
上传时间:2025/10/20 15:46:39
|
文件大小:2KB
|
文件类型:c
PerformanceMeasurement
ThereareatleasttwodifferentalgorithmsthatcancomputeXNforsomepositiveintegerN.Algorithm1istouseN–1multiplications.Algorithm2worksinthefollowingway:ifNiseven,XN=XN/2XN/2;andifNisodd,XN=X(N–1)/2X(N–1)/2X.Figure2.11inyourtextbookgivestherecursiveversionofthisalgorithm.Yourtasksare:(1)ImplementAlgorithm1andaniterativeversionofAlgorithm2;(2)Analyzethecomplexitiesofthetwoalgorithms;(3)MeasureandcomparetheperformancesofAlgorithm1andtheiterativeandrecursiveimplementationsofAlgorithm2forX=1.0001andN=1000,5000,10000,20000,40000,60000,80000,100000.
本软件ID:5281161