當前位置:首頁 » 招生排名 » 數據結構清華大學答案

數據結構清華大學答案

發布時間: 2023-01-15 17:13:58

❶ 求《數據結構》(C語言,第二版) 嚴蔚敏、吳偉民主編,清華大學出版社 課後習題答案

http://wenku..com/link?url=-wmTox3c-s9Pk6r0MyGk1N6YqJu-Fya9-LrzhksZfVTfM0R09K9kzLVq9d4_AtX-ZXlPWuZC

❷ 求 數據結構(c語言版)題集(清華大學出版社)答案

已經發給給你,記得給分。

❸ 求數據結構(用面向對象方法與C++語言描述)清華大學出版社 第2版 殷人昆課後題答案

已發 請採納!

❹ 跪求 清華大學出版社的數據結構(C語音版)(第2版)唐國民 王國鈞 主編的課後習題答案。

1.簡述下列概念:數據、數據元素、數據項、數據對象、數據結構、邏輯結構、存儲結構、抽象數據類型。
答案:
數據:是客觀事物的符號表示,指所有能輸入到計算機中並被計算機程序處理的符號的總稱。如數學計算中用到的整數和實數,文本編輯所用到的字元串,多媒體程序處理的圖形、圖像、聲音、動畫等通過特殊編碼定義後的數據。
數據元素:是數據的基本單位,在計算機中通常作為一個整體進行考慮和處理。在有些情況下,數據元素也稱為元素、結點、記錄等。數據元素用於完整地描述一個對象,如一個學生記錄,樹中棋盤的一個格局(狀態)、圖中的一個頂點等。
數據項:是組成數據元素的、有獨立含義的、不可分割的最小單位。例如,學生基本信息表中的學號、姓名、性別等都是數據項。
數據對象:是性質相同的數據元素的集合,是數據的一個子集。例如:整數數據對象是集合N={0,±1,±2,„},字母字元數據對象是集合C={『A』,『B』,„,『Z』, 『a』,『b』,„,『z』},學生基本信息表也可是一個數據對象。
數據結構:是相互之間存在一種或多種特定關系的數據元素的集合。換句話說,數據結構是帶「結構」的數據元素的集合,「結構」就是指數據元素之間存在的關系。
邏輯結構:從邏輯關繫上描述數據,它與數據的存儲無關,是獨立於計算機的。因此,數據的邏輯結構可以看作是從具體問題抽象出來的數學模型。
存儲結構:數據對象在計算機中的存儲表示,也稱為物理結構。
抽象數據類型:由用戶定義的,表示應用問題的數學模型,以及定義在這個模型上的一組操作的總稱。具體包括三部分:數據對象、數據對象上關系的集合和對數據對象的基本操作的集合。
2.試舉一個數據結構的例子,敘述其邏輯結構和存儲結構兩方面的含義和相互關系。
答案:
例如有一張學生基本信息表,包括學生的學號、姓名、性別、籍貫、專業等。每個學生基本信息記錄對應一個數據元素,學生記錄按順序號排列,形成了學生基本信息記錄的線性序列。對於整個表來說,只有一個開始結點(它的前面無記錄)和一個終端結點(它的後面無記錄),其他的結點則各有一個也只有一個直接前趨和直接後繼。學生記錄之間的這種關系就確定了學生表的邏輯結構,即線性結構。。。完整答案出處
數據結構_C語言版_第2版_唐國民_王國鈞_課後答案_清華大學出版社
http://www.daanjia.com/forum.php?mod=viewthread&tid=100156&fromuid=36878
(出處: 答案家)

❺ 清華大學嚴蔚敏數據結構題集完整答案(c語言版)

第一章 緒論
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) f=1;
else
{
for(i=0;i<=k-2;i++) temp[i]=0;
temp[k-1]=1; //初始化
for(i=k;i<=m;i++) //求出序列第k至第m個元素的值
{
sum=0;
for(j=i-k;j<i;j++) sum+=temp[j];
temp[i]=sum;
}
f=temp[m];
}
return OK;
}//fib
分析:通過保存已經計算出來的結果,此方法的時間復雜度僅為O(m^2).如果採用遞歸編程(大多數人都會首先想到遞歸方法),則時間復雜度將高達O(k^m).
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 ;
i=0;
while(result[i].sport!=NULL)
{
switch(result[i].schoolname)
{
case 'A':
score[ 0 ].totalscore+=result[i].score;
if(result[i].gender==0) score[ 0 ].malescore+=result[i].score;
else score[ 0 ].femalescore+=result[i].score;
break;
case 'B':
score .totalscore+=result[i].score;
if(result[i].gender==0) score .malescore+=result[i].score;
else score .femalescore+=result[i].score;
break;
…… …… ……
}
i++;
}
for(i=0;i<5;i++)
{
printf("School %d:\n",i);
printf("Total score of male:%d\n",score[i].malescore);
printf("Total score of female:%d\n",score[i].femalescore);
printf("Total score of all:%d\n\n",score[i].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 ad;
float *p=a;
printf("Input number of terms:");
scanf("%d",&n);
printf("Input the %d coefficients from a0 to a%d:\n",n,n);
for(i=0;i<=n;i++) scanf("%f",p++);
printf("Input value of x:");
scanf("%f",&x);
p=a;xp=1;sum=0; //xp用於存放x的i次方
for(i=0;i<=n;i++)
{
sum+=xp*(*p++);
xp*=x;
}
printf("Value is:%f",sum);
}//polyvalue

第二章 線性表
2.10
Status DeleteK(SqList &a,int i,int k)//刪除線性表a中第i個元素起的k個元素
{
if(i<1||k<0||i+k-1>a.length) return INFEASIBLE;
for(count=1;i+count-1<=a.length-k;count++) //注意循環結束的條件
a.elem[i+count-1]=a.elem[i+count+k-1];
a.length-=k;
return OK;
}//DeleteK
2.11
Status Insert_SqList(SqList &va,int x)//把x插入遞增有序表va中
{
if(va.length+1>va.listsize) return ERROR;
va.length++;
for(i=va.length-1;va.elem[i]>x&&i>=0;i--)
va.elem[i+1]=va.elem[i];
va.elem[i+1]=x;
return OK;
}//Insert_SqList
2.12
int ListComp(SqList A,SqList B)//比較字元表A和B,並用返回值表示結果,值為正,表示A>B;值為負,表示A<B;值為零,表示A=B
{
for(i=1;A.elem[i]||B.elem[i];i++)
if(A.elem[i]!=B.elem[i]) return A.elem[i]-B.elem[i];
return 0;
}//ListComp
2.13
LNode* Locate(LinkList L,int x)//鏈表上的元素查找,返回指針
{
for(p=l->next;p&&p->data!=x;p=p->next);
return p;
}//Locate
2.14
int Length(LinkList L)//求鏈表的長度
{
for(k=0,p=L;p->next;p=p->next,k++);
return k;
}//Length
2.15
void ListConcat(LinkList ha,LinkList hb,LinkList &hc)//把鏈表hb接在ha後面形成鏈表hc
{
hc=ha;p=ha;
while(p->next) p=p->next;
p->next=hb;
}//ListConcat
2.16
見書後答案.
2.17
Status Insert(LinkList &L,int i,int b)//在無頭結點鏈表L的第i個元素之前插入元素b
{
p=L;q=(LinkList*)malloc(sizeof(LNode));
q.data=b;
if(i==1)
{
q.next=p;L=q; //插入在鏈表頭部
}
else
{
while(--i>1) p=p->next;
q->next=p->next;p->next=q; //插入在第i個元素的位置
}
}//Insert
2.18
Status Delete(LinkList &L,int i)//在無頭結點鏈表L中刪除第i個元素
{
if(i==1) L=L->next; //刪除第一個元素
else
{
p=L;
while(--i>1) p=p->next;
p->next=p->next->next; //刪除第i個元素
}
}//Delete
2.19
Status Delete_Between(Linklist &L,int mink,int maxk)//刪除元素遞增排列的鏈表L中值大於mink且小於maxk的所有元素
{
p=L;
while(p->next->data<=mink) p=p->next; //p是最後一個不大於mink的元素
if(p->next) //如果還有比mink更大的元素
{
q=p->next;
while(q->data<maxk) q=q->next; //q是第一個不小於maxk的元素
p->next=q;
}
}//Delete_Between
2.20
Status Delete_Equal(Linklist &L)//刪除元素遞增排列的鏈表L中所有值相同的元素
{
p=L->next;q=p->next; //p,q指向相鄰兩元素
while(p->next)
{
if(p->data!=q->data)
{
p=p->next;q=p->next; //當相鄰兩元素不相等時,p,q都向後推一步
}
else
{
while(q->data==p->data)
{
free(q);
q=q->next;
}
p->next=q;p=q;q=p->next; //當相鄰元素相等時刪除多餘元素
}//else
}//while
}//Delete_Equal
2.21
void reverse(SqList &A)//順序表的就地逆置
{
for(i=1,j=A.length;i<j;i++,j--)
A.elem[i]<->A.elem[j];
}//reverse
2.22
void LinkList_reverse(Linklist &L)//鏈表的就地逆置;為簡化演算法,假設表長大於2
{
p=L->next;q=p->next;s=q->next;p->next=NULL;
while(s->next)
{
q->next=p;p=q;
q=s;s=s->next; //把L的元素逐個插入新表表頭
}
q->next=p;s->next=q;L->next=s;
}//LinkList_reverse
分析:本演算法的思想是,逐個地把L的當前元素q插入新的鏈表頭部,p為新表表頭.
2.23
void merge1(LinkList &A,LinkList &B,LinkList &C)//把鏈表A和B合並為C,A和B的元素間隔排列,且使用原存儲空間
{
p=A->next;q=B->next;C=A;
while(p&&q)
{
s=p->next;p->next=q; //將B的元素插入
if(s)
{
t=q->next;q->next=s; //如A非空,將A的元素插入
}
p=s;q=t;
}//while
}//merge1
2.24
void reverse_merge(LinkList &A,LinkList &B,LinkList &C)//把元素遞增排列的鏈表A和B合並為C,且C中元素遞減排列,使用原空間
{
pa=A->next;pb=B->next;pre=NULL; //pa和pb分別指向A,B的當前元素
while(pa||pb)
{
if(pa->data<pb->data||!pb)
{
pc=pa;q=pa->next;pa->next=pre;pa=q; //將A的元素插入新表
}
else
{
pc=pb;q=pb->next;pb->next=pre;pb=q; //將B的元素插入新表
}
pre=pc;
}
C=A;A->next=pc; //構造新表頭
}//reverse_merge
分析:本演算法的思想是,按從小到大的順序依次把A和B的元素插入新表的頭部pc處,最後處理A或B的剩餘元素.
2.25
void SqList_Intersect(SqList A,SqList B,SqList &C)//求元素遞增排列的線性表A和B的元素的交集並存入C中
{
i=1;j=1;k=0;
while(A.elem[i]&&B.elem[j])
{
if(A.elem[i]<B.elem[j]) i++;
if(A.elem[i]>B.elem[j]) j++;
if(A.elem[i]==B.elem[j])
{
C.elem[++k]=A.elem[i]; //當發現了一個在A,B中都存在的元素,
i++;j++; //就添加到C中
}
}//while
}//SqList_Intersect
2.26
void LinkList_Intersect(LinkList A,LinkList B,LinkList &C)//在鏈表結構上重做上題
{
p=A->next;q=B->next;
pc=(LNode*)malloc(sizeof(LNode));
while(p&&q)
{
if(p->data<q->data) p=p->next;
else if(p->data>q->data) q=q->next;
else
{
s=(LNode*)malloc(sizeof(LNode));
s->data=p->data;
pc->next=s;pc=s;
p=p->next;q=q->next;
}
}//while
C=pc;
}//LinkList_Intersect
2.27
void SqList_Intersect_True(SqList &A,SqList B)//求元素遞增排列的線性表A和B的元素的交集並存回A中
{
i=1;j=1;k=0;
while(A.elem[i]&&B.elem[j])
{
if(A.elem[i]<B.elem[j]) i++;
else if(A.elem[i]>B.elem[j]) j++;
else if(A.elem[i]!=A.elem[k])
{
A.elem[++k]=A.elem[i]; //當發現了一個在A,B中都存在的元素
i++;j++; //且C中沒有,就添加到C中
}
}//while
while(A.elem[k]) A.elem[k++]=0;
}//SqList_Intersect_True
2.28
void LinkList_Intersect_True(LinkList &A,LinkList B)//在鏈表結構上重做上題
{
p=A->next;q=B->next;pc=A;
while(p&&q)
{
if(p->data<q->data) p=p->next;
else if(p->data>q->data) q=q->next;
else if(p->data!=pc->data)
{
pc=pc->next;
pc->data=p->data;
p=p->next;q=q->next;
}
}//while
}//LinkList_Intersect_True
2.29
void SqList_Intersect_Delete(SqList &A,SqList B,SqList C)
{
i=0;j=0;k=0;m=0; //i指示A中元素原來的位置,m為移動後的位置
while(i<A.length&&j<B.length&& k<C.length)
{
if(B.elem[j]<C.elem[k]) j++;
else if(B.elem[j]>C.elem[k]) k++;
else
{
same=B.elem[j]; //找到了相同元素same
while(B.elem[j]==same) j++;
while(C.elem[k]==same) k++; //j,k後移到新的元素
while(i<A.length&&A.elem[i]<same)
A.elem[m++]=A.elem[i++]; //需保留的元素移動到新位置
while(i<A.length&&A.elem[i]==same) i++; //跳過相同的元素
}
}//while
while(i<A.length)
A.elem[m++]=A.elem[i++]; //A的剩餘元素重新存儲。
A.length=m;
}// SqList_Intersect_Delete
分析:先從B和C中找出共有元素,記為same,再在A中從當前位置開始, 凡小於same的
元素均保留(存到新的位置),等於same的就跳過,到大於same時就再找下一個same.
2.30
void LinkList_Intersect_Delete(LinkList &A,LinkList B,LinkList C)//在鏈表結構上重做上題
{
p=B->next;q=C->next;r=A-next;
while(p&&q&&r)
{
if(p->data<q->data) p=p->next;
else if(p->data>q->data) q=q->next;
else
{
u=p->data; //確定待刪除元素u
while(r->next->data<u) r=r->next; //確定最後一個小於u的元素指針r
if(r->next->data==u)
{
s=r->next;
while(s->data==u)
{
t=s;s=s->next;free(t); //確定第一個大於u的元素指針s
}//while
r->next=s; //刪除r和s之間的元素
}//if
while(p->data=u) p=p->next;
while(q->data=u) q=q->next;
}//else
}//while
}//LinkList_Intersect_Delete
2.31
Status Delete_Pre(CiLNode *s)//刪除單循環鏈表中結點s的直接前驅
{
p=s;
while(p->next->next!=s) p=p->next; //找到s的前驅的前驅p
p->next=s;
return OK;
}//Delete_Pre
2.32
Status DuLNode_Pre(DuLinkList &L)//完成雙向循環鏈表結點的pre域
{
for(p=L;!p->next->pre;p=p->next) p->next->pre=p;
return OK;
}//DuLNode_Pre
2.33
Status LinkList_Divide(LinkList &L,CiList &A,CiList &B,CiList &C)//把單鏈表L的元素按類型分為三個循環鏈表.CiList為帶頭結點的單循環鏈表類型.
{
s=L->next;
A=(CiList*)malloc(sizeof(CiLNode));p=A;
B=(CiList*)malloc(sizeof(CiLNode));q=B;
C=(CiList*)malloc(sizeof(CiLNode));r=C; //建立頭結點
while(s)
{
if(isalphabet(s->data))
{
p->next=s;p=s;
}
else if(isdigit(s->data))
{
q->next=s;q=s;
}
else
{
r->next=s;r=s;
}
}//while
p->next=A;q->next=B;r->next=C; //完成循環鏈表
}//LinkList_Divide
2.34
void Print_XorLinkedList(XorLinkedList L)//從左向右輸出異或鏈表的元素值
{
p=L.left;pre=NULL;
while(p)
{
printf("%d",p->data);
q=XorP(p->LRPtr,pre);
pre=p;p=q; //任何一個結點的LRPtr域值與其左結點指針進行異或運算即得到其右結點指針
}
}//Print_XorLinkedList
2.35
Status Insert_XorLinkedList(XorLinkedList &L,int x,int i)//在異或鏈表L的第i個元素前插入元素x
{
p=L.left;pre=NULL;
r=(XorNode*)malloc(sizeof(XorNode));
r->data=x;
if(i==1) //當插入點在最左邊的情況
{
p->LRPtr=XorP(p.LRPtr,r);
r->LRPtr=p;
L.left=r;
return OK;
}
j=1;q=p->LRPtr; //當插入點在中間的情況
while(++j<i&&q)
{
q=XorP(p->LRPtr,pre);
pre=p;p=q;
}//while //在p,q兩結點之間插入
if(!q) return INFEASIBLE; //i不可以超過表長
p->LRPtr=XorP(XorP(p->LRPtr,q),r);
q->LRPtr=XorP(XorP(q->LRPtr,p),r);
r->LRPtr=XorP(p,q); //修改指針
return OK;
}//Insert_XorLinkedList
2.36
Status Delete_XorLinkedList(XorlinkedList &L,int i)//刪除異或鏈表L的第i個元素
{
p=L.left;pre=NULL;
if(i==1) //刪除最左結點的情況
{
q=p->LRPtr;
q->LRPtr=XorP(q->LRPtr,p);
L.left=q;free(p);
return OK;
}
j=1;q=p->LRPtr;
while(++j<i&&q)
{
q=XorP(p->LRPtr,pre);
pre=p;p=q;
}//while //找到待刪結點q
if(!q) return INFEASIBLE; //i不可以超過表長
if(L.right==q) //q為最右結點的情況
{
p->LRPtr=XorP(p->LRPtr,q);
L.right=p;free(q);
return OK;
}
r=XorP(q->LRPtr,p); //q為中間結點的情況,此時p,r分別為其左右結點
p->LRPtr=XorP(XorP(p->LRPtr,q),r);
r->LRPtr=XorP(XorP(r->LRPtr,q),p); //修改指針
free(q);
return OK;
}//Delete_XorLinkedList
2.37
void OEReform(DuLinkedList &L)//按1,3,5,...4,2的順序重排雙向循環鏈表L中的所有結點
{
p=L.next;
while(p->next!=L&&p->next->next!=L)
{
p->next=p->next->next;
p=p->next;
} //此時p指向最後一個奇數結點
if(p->next==L) p->next=L->pre->pre;
else p->next=l->pre;
p=p->next; //此時p指向最後一個偶數結點
while(p->pre->pre!=L)
{
p->next=p->pre->pre;
p=p->next;
}
p->next=L; //按題目要求調整了next鏈的結構,此時pre鏈仍為原狀
for(p=L;p->next!=L;p=p->next) p->next->pre=p;
L->pre=p; //調整pre鏈的結構,同2.32方法
}//OEReform
分析:next鏈和pre鏈的調整隻能分開進行.如同時進行調整的話,必須使用堆棧保存偶數結點的指針,否則將會破壞鏈表結構,造成結點丟失.
2.38
DuLNode * Locate_DuList(DuLinkedList &L,int x)//帶freq域的雙向循環鏈表上的查找
{
p=L.next;
while(p.data!=x&&p!=L) p=p->next;
if(p==L) return NULL; //沒找到
p->freq++;q=p->pre;
while(q->freq<=p->freq) q=q->pre; //查找插入位置
if(q!=p->pre)
{
p->pre->next=p->next;p->next->pre=p->pre;
q->next->pre=p;p->next=q->next;
q->next=p;p->pre=q; //調整位置
}
return p;
}//Locate_DuList
2.39
float GetValue_SqPoly(SqPoly P,int x0)//求升冪順序存儲的稀疏多項式的值
{
PolyTerm *q;
xp=1;q=P.data;
sum=0;ex=0;
while(q->coef)
{
while(ex<q->exp) xp*=x0;
sum+=q->coef*xp;
q++;
}
return sum;
}//GetValue_SqPoly
2.40
void Subtract_SqPoly(SqPoly P1,SqPoly P2,SqPoly &P3)//求稀疏多項式P1減P2的差式P3
{
PolyTerm *p,*q,*r;
Create_SqPoly(P3); //建立空多項式P3
p=P1.data;q=P2.data;r=P3.data;
while(p->coef&&q->coef)
{
if(p->exp<q->exp)
{
r->coef=p->coef;
r->exp=p->exp;
p++;r++;
}
else if(p->exp<q->exp)
{
r->coef=-q->coef;
r->exp=q->exp;
q++;r++;
}
else
{
if((p->coef-q->coef)!=0) //只有同次項相減不為零時才需要存入P3中
{
r->coef=p->coef-q->coef;
r->exp=p->exp;r++;
}//if
p++;q++;
}//else
}//while
while(p->coef) //處理P1或P2的剩餘項
{
r->coef=p->coef;
r->exp=p->exp;
p++;r++;
}
while(q->coef)
{
r->coef=-q->coef;
r->exp=q->exp;
q++;r++;
}
}//Subtract_SqPoly
2.41
void QiuDao_LinkedPoly(LinkedPoly &L)//對有頭結點循環鏈表結構存儲的稀疏多項式L求導
{
p=L->next;
if(!p->data.exp)
{
L->next=p->next;p=p->next; //跳過常數項
}
while(p!=L)
{
p->data.coef*=p->data.exp--;//對每一項求導
p=p->next;
}
}//QiuDao_LinkedPoly
2.42
void Divide_LinkedPoly(LinkedPoly &L,&A,&B)//把循環鏈表存儲的稀疏多項式L拆成只含奇次項的A和只含偶次項的B
{
p=L->next;
A=(PolyNode*)malloc(sizeof(PolyNode));
B=(PolyNode*)malloc(sizeof(PolyNode));
pa=A;pb=B;
while(p!=L)
{
if(p->data.exp!=2*(p->data.exp/2))
{
pa->next=p;pa=p;
}
else
{
pb->next=p;pb=p;
}
p=p->next;
}//while
pa->next=A;pb->next=B;
}//Divide_LinkedPoly

❻ 誰有清華大學嚴蔚敏老師的數據結構題集(C語言版)詳細答案

發了
請給分

❼ 急需數據結構C語言版(清華大學出版社)的期末考試試題及答案

《數據結構》期末考試試卷( A )

一、 選擇題(每小題2分,共24分)
1.計算機識別、存儲和加工處理的對象被統稱為( A )
A.數據 B.數據元素
C.數據結構 D.數據類型
2.棧和隊列都是( A )
A.限制存取位置的線性結構 B.順序存儲的線性結構
C.鏈式存儲的線性結構 D.限制存取位置的非線性結構
3.鏈棧與順序棧相比,比較明顯的優點是( D )
A.插入操作更加方便 B.刪除操作更加方便
C.不會出現下溢的情況 D.不會出現上溢的情況
4.採用兩類不同存儲結構的字元串可分別簡稱為( B )
A.主串和子串 B.順序串和鏈串
C.目標串和模式串 D.變數串和常量串
5. 一個向量第一個元素的存儲地址是100,每個元素的長度為2,則第5個元素的地址是:B
A. 110 B .108
C. 100 D. 120
6.串是一種特殊的線性表,其特殊性體現在:B
A.可以順序存儲 B .數據元素是一個字元
C. 可以鏈接存儲 D. 數據元素可以是多個字元
7.設高度為h的二叉樹上只有度為0和度為2的結點,則此類二叉樹中所包含的結點數至少為: C
A. 2h B .2h-1
C. 2h+1 D. h+1
軟體開發網
8.樹的基本遍歷策略可分為先根遍歷和後根遍歷;二叉樹的基本遍歷策略可分為先序遍歷、中序遍歷和後序遍歷。這里,我們把 由樹轉化得到的二叉樹叫做這棵樹對應的二叉樹。下列結論哪個正確? A
A. 樹的先根遍歷序列與其對應的二叉樹的先序遍歷序列相同
B .樹的後根遍歷序列與其對應的二叉樹的後序遍歷序列相同
C. 樹的先根遍歷序列與其對應的二叉樹的中序遍歷序列相同
D. 以上都不對
9.一個有n個頂點的無向圖最多有多少邊?C
A. n B .n(n-1)
C. n(n-1)/2 D. 2n
10.在一個圖中,所有頂點的度數之和等於所有邊數的多少倍?C
A. 1/2 B .1
C. 2 D. 4
11.當在二叉排序樹中插入一個新結點時,若樹中不存在與待插入結點的關鍵字相同的結點,且新結點的關鍵字小於根結點的關鍵字,則新結點將成為( A )
A.左子樹的葉子結點 B.左子樹的分支結點
C.右子樹的葉子結點 D.右子樹的分支結點
軟體開發網
12.對於哈希函數H(key)=key%13,被稱為同義詞的關鍵字是( D )
A.35和41 B.23和39
C.15和44 D.25和51
二、已知某棵二叉樹的前序遍歷結果為A,B,D,E,G,C,F,H,I,J,其中中序遍歷的結果為D,B,G,E,A,H,F,I,J,C。請畫出二叉的具體結構。(注意要寫出具體步驟)(10分)
原理見課本128頁

三、有圖如下,請寫出從頂點c0出發的深度優先及寬度優先遍歷的結果。(10分)
深度優先;C0-C1-C3-C4-C5-C2
寬度優先:C0-C1-C2-C3-C4-C5
四、有圖如下,按Kruskal演算法求出其最小生成樹。要求寫出完整的步驟。(10分)
原理見課本250頁

五、給定線性表(12,23,45,66,76,88,93,103,166),試寫出在其上進行二分查找關鍵字值12,93,166的過程。並寫出二分查找的演算法。(20分)
0 1 2 3 4 5 6 7 8
12 23 45 66 76 88 93 103 166
過程:
mid=(0+8)/2=4
high=3,low=0 mid=1
high=0,low=0 mid=0(找到12)
high=8,low=5,mid=6(找到93)
high=8,low=7,mid=7
high=8 low=8 mid=8
演算法:見課本84頁上

六、知單鏈表的結點結構為
Data next
下列演算法對帶頭結點的單鏈表L進行簡單選擇排序,使得L中的元素按值從小到大排列。
請在空缺處填入合適的內容,使其成為完整的演算法。 (可用文字說明該演算法的基本思想及執行的過程,10分)
void SelectSort(LinkedList L)
{
LinkedList p,q,min;
DataType rcd;
p= (1) ;
while(p!=NULL) {
min=p;
q=p->next;
while(q!=NULL){
if( (2) )min=q;
q=q->next;
}
if( (3) ){
rcd=p->data;
p->data=min->data;
min->data=rcd;
}
(4) ;
}
}
本題不會。嘿嘿。。。。
七、一個完整的演算法應該具有哪幾個基本性質?分別簡要說明每一性質的含意。(5分)
輸入:
四個基本性質:1.輸入:有零個或多個有外部提供的量作為演算法的輸入
2:輸出:演算法產生至少一個量作為輸出
3.:確定性:組成演算法的每條指令是清晰的,無歧異的。
4.:有限性:演算法中每條指令的執行次數是有限的,執行每條指令的時間也是有限的

八、何謂隊列的"假溢"現象?如何解決?(5分)
隊列的假溢現象是指數組實現的順序隊列中,隊尾指針已到達數組的下表上界產生上溢而隊頭指針之前還有若干 空間閑置的現象。解決的辦法之一是利用循環隊列技術使數組空間的首尾相連。

九、說明並比較文件的各種物理結構。(6分)

❽ 數據結構(用面向對象的方法與C++語言描述)第二版殷人昆 清華大學出版社 答案

附件中是我當時學數據結構時用的答案,希望對你有幫助。

❾ 跪求數據結構教程第三版答案 ········· 清華大學出版社

This summer the unique female voice she is happy LiuXin

Chip favorite my favorite she is LiuXin

A very common name an extremely not common LiuXin

She is LiuXin who all don't replace the LiuXin

LiuXin a malicious sensible child

LiuXin a malicious instrious child

LiuXin no ordinary children

LiuXin a malicious will care about people's children

LiuXin a malicious will take care of other people's children but never know how to take care of their children

Even if some don't know not familiar with LiuXin people see the tattoo on her arm in her ears to drink the ear hole would think it is bad boy image

But LiuXin and not so she is a malicious good children only have too many things in her body she want to remember all those things

She wear half sleeve of the time like to sit on the arm of her tattoo block this is not her in the cool

But she said she didn't want to others??????

2011 took part in the fast woman LiuXin she is the champion of the changsha

That sentence today automatic promotion has six now have a us as long as five places that much

The words of a show for words we listened to LiuXin she is a confident children is a powerful children

She LiuXin are always our hearts champions

Her beautiful song really really good. Good attract stone

LiuXin she is we always love female silver

LiuXin is the fast female stage another miracle

A heroes of the hearts of the men of affects many including the affirmation of the straight into the judges

LiuXin joy and not make public smile could see that she's happy also can feel to get her pay paid off

2008 years LiuXin to South Korea in JYP training although finally lost although also only released two songs

But it all for LiuXin more opportunities to 2011 years of fast female changsha champions than other women her quick more experience more mature thinking

No matter who left never gas field

The sad or sad forever reason never to do treat in the choice

The size of the age to she can compared to the others took care of the teammates have also made her all the more unique

More and more love is like this

This summer I will be forever remembered for kids LiuXin and beautiful

If 50 years later kids still sings I promise I will listen

❿ 求 數據結構 第二版 (張世和 徐繼延 著) 清華大學出版社 課後答案

222222333265656665

熱點內容
四川農業大學申請考核博士 發布:2025-10-20 08:58:11 瀏覽:981
福田雷沃重工本科生待遇怎麼樣 發布:2025-10-20 08:53:49 瀏覽:575
華為要本科生嗎 發布:2025-10-20 08:25:41 瀏覽:550
2008年青島本科生工資 發布:2025-10-20 08:04:24 瀏覽:444
東北大學藝術考研 發布:2025-10-20 07:38:35 瀏覽:299
我的大學生活txt 發布:2025-10-20 07:35:28 瀏覽:25
人民大學外語系考研 發布:2025-10-20 07:31:12 瀏覽:894
上海交通大學考研輔導班 發布:2025-10-20 07:24:54 瀏覽:420
華中農業大學細胞生物學考研群 發布:2025-10-20 07:09:36 瀏覽:558
南京大學2016考研線 發布:2025-10-20 06:43:12 瀏覽:930