华东师范大学《数据结构》2018-2019学年期末试卷.docxVIP

  • 0
  • 0
  • 约1.7千字
  • 约 6页
  • 2026-01-21 发布于江西
  • 举报

华东师范大学《数据结构》2018-2019学年期末试卷.docx

*high_node,//fromlastnodewithNULLrightchild

*low_node;//candidateforrightchildofhighnode

if(highnode-right!=NULL)

voidmove(intcount,intstart,intfinish,inttemp)

if(count0){

coutMovediskcountfromstart

tofinish

end!;

:,.根据课本内容补全如下Trio的插入insert程序代码。

压or_codeTrie::insert(constRecorlnew_entry)

/*Post:IftheKeyofnew_entryisalreadyintheTrie,acodeofduplicate_errorisreturned.Otherwise,acoleofsuccessisreturnedandtheRecordnewentryisinsertedintotheTrie.*/

Error_coderesult=success;

if(root==NULL)root=newTrie_node;IICreateanewemptyTrie.

intposition=O;//indexeslettersofnewentry

charnext_char;

Tric_node*location=root;//movesthroughtheTrie

while(ncxt_char=-new_entry.key_letter(position)!=\O){

intnext_position=alphabetic_order(next_char);

if(

【5】

)location-hranch[next_position]==newTrie_node;

location=location-branch[next_positionJ;

position叶;

if(

【6】

)result=duplicateerror;

elselocation-data=newRecord(new_entry);

returnresult;

?,

和序分析题(20分,

每题5分)

lS)的伯。

根据如F递I门程序代码,给出表达式rune(12,

intPunc(inli,intj){

if(i1I)

ifUll)

return1+J:

else

returnj-1「unc(i,j?2);

else

returni+Func(i-1,j);

2.分别给出下图从顶点0出发的庥度优先遍历序列和广度优先遍历厅列。

2。

St叩

5

6

7

3

.3A,

将如下的序列插入到-棵空的AVL树中后,Z,B,Y,C,X,D,W,E,V,r

给出该树的前序,中序,后序

4.解释B树的定义,;并给出如T寸名列插入-颗空的厅为5的B树的图示过程。a,g气t:b,k,d,h,m,j,e,s,i,r,x气C,I,11,t,U

5给出如下厅列插入一个空的小根堆(根最小)的图示过程。括入完成后,给出删除根以后的新堆的形态u

10,12,l,14,6,5,8,15,3,9,4,11,13,2

6.木良才居如卜的有向图,给出从顶点()分别到其他顶点的最短路径以及数们

10

9

4

6

4

intdata;

Node*next;

文档评论(0)

1亿VIP精品文档

相关文档