当前位置:去回答>生活百科>数据结构英文试题

数据结构英文试题

2024-10-09 00:25:31 编辑:join 浏览量:566

数据结构英文试题

杭州电子工业学院学生考试卷(A)卷

考试课程数据结构与算法考试日期年月日成绩班级2000软件姓名学号

1.(8分)Imaginewehavetwoemptystacksofintegers,s1ands2.drawapictureofeachstackafterthefollowingoperations:

PushStack(s1,3);

PushStack(s1,-5);

PushStack(s1,7);

PushStack(s1,-9);

PushStack(s1,11);

PushStack(s1,-13);

while(notemptyStack(s1)){

popStack(s1,x);

if(x0){

pushStack(s2,x);

}

}//while

2.(8分)Usingmanualtransformation,changethefollowingpostfixorprefixexpressionstoinfixform.

a.ABC+D-b.-A+BCD

3.(8分)whatwouldbethecontentsofqueueQ1afterthefollowingcodeisexecutedandthefollowingdataareentered?

Q1=CreateQueue

S1=CreateStack

loop(notendoffile)

readnumber

if(numbernot0)

pushStack(S1,number)

else

popStack(S1,x)

popStack(S1,x)

loop(notemptyStack(S1))

popStack(S1,x)

enqueue(Q1,x)

endloop

endif

endloop

Thedataare5,7,12,4,0,4,6,8,67,34,23,5,0,44,33,22,6,0.

4.(8分)CreateaAVLtreeusingthefollowingdataenteredasasequentialset:

7,10,14,23,33,56,66,70,80,90.

5.(8分)Showtheresultingheapafter33,22,and8areaddedtothefollowingheap:

50,30,40,20,10,25,35,10,5.

6.(8分)Aftertwopassesofasortingalgorithm,thefollowarray:

48,5,29,36,7,61,88

hasbeenrearrangedasshownbelow:5,7,48,29,36,61,88

whichsortingalgorithmisbeingused(straightselection,bubble,straightinsertion)?Defendyouranswer.

7.(8分)Agraphcanbeusedtoshowrelationships,forexample,fromthefollowinglistofpeoplebelongingtothesameclub(vertices)andtheirfriendships(edges).

People={George,Jim,Jean,Frank,Fred,John,Susan}

FriendShip={(George,Jean),(Frank,Fred),

(George,John),(Jim,Fred),(Jim,Frank),

(Jim,Susan),(Susan,Frank)}

Givetheadjacencylistrepresentationofthisgraph.

AlgorithmDesign1.(11分)Writeanalgorithmthattraversesalinkedlistanddeletesallnodeswhosekeysarenegative.

2.(11分)Writeanalgorithmthatcountsthenumberofleavesinabinarytree.

3.(11分)WriteanalgorithmcalledQueueToStackthatcreatesastackfromaqueue.Attheendofthealgorithm,thequeueshouldbeunchanged;thefrontofthequeueshouldbethetopofthestack;andtherearofthequeueshouldbethebaseofthestack.

4.(11分)Developanon-recursiveBST(BinarySearchTree)searchalgorithmSearchBST.

标签:数据结构,试题,英文

版权声明:文章由 去回答 整理收集,来源于互联网或者用户投稿,如有侵权,请联系我们,我们会立即处理。如转载请保留本文链接:https://www.quhuida.com/life/292731.html
热门文章