⑴ 你有數據結構與演算法分析(c語言描述)原書第二版的課後習題答案嗎
http://wenku..com/view/30ab767b5acfa1c7aa00ccec.html
⑵ 數據結構與演算法分析 第三版 習題答案 12 章 Mark.Allen
2424525785876
⑶ 數據結構與演算法分析 廖明宏 答案
那,我也不知道是不是你說的答案,你自己看著辦吧。
貼了一部分 看看
第一章 緒論
1.16
void print_descending(int x,int y,int z)//按從大到小順序輸出三個數
{
scanf("%d,%d,%d",&x,&y,&z);
if(x<y) x<->y; //<->為表示交換的雙目運算符,以下同
if(y<z) y<->z;
if(x<y) x<->y; //冒泡排序
printf("%d %d %d",x,y,z);
}//print_descending
1.17
Status fib(int k,int m,int &f)//求k階斐波那契序列的第m項的值f
{
int tempd;
if(k<2||m<0) return ERROR;
if(m<k-1) f=0;
else if (m==k-1 || m==k) f=1;
else
{
for(i=0;i<=k-2;i++) temp=0;
temp[k-1]=1;temp[k]=1; //初始化
sum=1;
j=0;
for(i=k+1;i<=m;i++,j++) //求出序列第k至第m個元素的值
temp=2*sum-temp[j];
f=temp[m];
}
return OK;
}//fib
分析: k階斐波那契序列的第m項的值f[m]=f[m-1]+f[m-2]+......+f[m-k]
=f[m-1]+f[m-2]+......+f[m-k]+f[m-k-1]-f[m-k-1]
=2*f[m-1]-f[m-k-1]
所以上述演算法的時間復雜度僅為O(m). 如果採用遞歸設計,將達到O(k^m). 即使採用暫存中間結果的方法,也將達到O(m^2).
1.18
typedef struct{
char *sport;
enum{male,female} gender;
char schoolname; //校名為'A','B','C','D'或'E'
char *result;
int score;
} resulttype;
typedef struct{
int malescore;
int femalescore;
int totalscore;
} scoretype;
void summary(resulttype result[ ])//求各校的男女總分和團體總分,假設結果已經儲存在result[ ]數組中
{
scoretype score[MAXSIZE];
i=0;
while(result.sport!=NULL)
{
switch(result.schoolname)
{
case 'A':
score[ 0 ].totalscore+=result.score;
if(result.gender==0) score[ 0 ].malescore+=result.score;
else score[ 0 ].femalescore+=result.score;
break;
case 'B':
score[ 0 ].totalscore+=result.score;
if(result.gender==0) score[ 0 ].malescore+=result.score;
else score[ 0 ].femalescore+=result.score;
break;
…… …… ……
}
i++;
}
for(i=0;i<5;i++)
{
printf("School %d:\n",i);
printf("Total score of male:%d\n",score.malescore);
printf("Total score of female:%d\n",score.femalescore);
printf("Total score of all:%d\n\n",score.totalscore);
}
}//summary
1.19
Status algo119(int a[ARRSIZE])//求i!*2^i序列的值且不超過maxint
{
last=1;
for(i=1;i<=ARRSIZE;i++)
{
a[i-1]=last*2*i;
if((a[i-1]/last)!=(2*i)) reurn OVERFLOW;
last=a[i-1];
return OK;
}
}//algo119
分析:當某一項的結果超過了maxint時,它除以前面一項的商會發生異常.
1.20
void polyvalue()
{
float temp;
float *p=a;
printf("Input number of terms:");
scanf("%d",&n);
printf("Input value of x:");
scanf("%f",&x);
printf("Input the %d coefficients from a0 to a%d:\n",n+1,n);
p=a;xp=1;sum=0; //xp用於存放x的i次方
for(i=0;i<=n;i++)
{
scanf("%f",&temp);
sum+=xp*(temp);
xp*=x;
}
printf("Value is:%f",sum);
}//polyvalue
⑷ 《數據結構與演算法分析(C語言描述原書第2版)》習題答案
我有, 請給分
⑸ Data Structures and Algorithm Analysis in C++書後的習題答案
第一階段:
1::H.M.Deitel和P.J.Deitel的《 C++ How to Program 》(C++大學教程)
2:: 錢能的《C++程序設計教程》
3::Stanley B.lippman著 侯捷 譯的《essential c++》
4::Stanley B.Lippman,Josee LaJoie,Barbara E.Moo的《c++ primer》
5::Bjarne Stroustrup的《the c++ programming language》
第二階段:
1::Scott Meyers的《effective c++》
2::Herb Sutter的《exceptional c++》
3::Scott Meyers的《more effective c++》
4::Herb Sutter的《more exceptional c++》
第三階段:
1::Stanley B.lippman的《insied the c++ object model》(深度探索C++ 對象模型)
2::Bjarne Stroustrup的《The design and evolution of c++》(C++的設 計與演化)
3::tephen C. Dewhurst的《C++ Gotchas: Avoiding Common Problems in Coding and Design》(C++程序設計陷阱)
第四階段:
1:: Nicolai M.Josuttis的《the c++ standard library》(C++標准程序庫 —自修教程與參考手冊)
2::Scott Meyers的《effective stl》
3::Matthew H. Austern的《generic programming and the stl》(泛型編 程與STL)
4::侯捷的 《stl源碼剖析》
第五階段:
1::Herb Sutter的《exeptional c++ style》
2::《c++ template》
3::Andrei Alexandrescu的《modern c++ design》
第六階段
1::《C++ 輸入輸出流及本地化》《C++ Network Programming》《大規模C++程序設計》
2::Barbara E.Moo和Andrew Koenig的《Ruminations On C++》(C++ 沉思錄)
其他的:
Stanley B. Lippman,《Inside The C++ Object Model》影印版、中文版《深度探索C++對象模型》
Elements of Reusable Object-Oriented software》影印版、中文版《設計模式:可復用面向對象軟體的基礎》
John Lakos的著作《Large-Scale C++ Software Design》(《大規模C++程序設計》
Andrew Koenig和Barbara Moo在《Accelerated C++: Practical Programming by Example》《Ruminations on C++》
Bruce Eckel,《C++編程思想》
windows編程系列:
Charles Petzold 的 《Programming Windows》(Windows程序設計)
Jeffrey Richter 的《》(Windows核心編程)和《Advanced Windows》(Windows 高級編程指南)
數據結構和演算法
1::清華教授嚴蔚敏和廣東工業大學教授吳偉民的《數據結構(C語言版)》
2::清華教授殷人昆的《數據結構(用面向對象方法與C++描述)》
3::經典書籍:Mark Allen Weiss的《Data Structures and Algorithm Analysis in C》(數據結構與演算法分析--C語言描述)和《Data Structures and Algorithm Analysis in C++》(數據結構與演算法分析--C++語言描述)
4::王曉東的《演算法設計與分析》
5::M.H.Alsuwaiyel(沙特)的 《Algorithms Design Techniques and Analysis》(演算法設計技巧與分析)
6::經典:Thomas H.Cormen, Charles E.Leiserson的《Introction to Algorithms》(演算法導論)
⑹ 數據結構與演算法分析第二版 C語言描述 中文的課後答案 機械工業出版社的~一定要中文的啊~
我個人覺得還是書更好,買個二手書的話便宜又更加實用!!
⑺ 急求數據結構與演算法分析(c++)第二版 課後答案
樓上的是用C語言描述的,這里有用C++描述的,地址:http://d116.d.iask.com/fs/800/1//pdf/數據結構與演算法分析.pdf
⑻ 求數據結構與演算法分析(C++版)(第二版)課後習題答案,謝謝
http://ishare.iask.sina.com.cn/f/18699307.html
如果沒有賬號,注冊一個;如果不想注冊,我下載好了再給你