欢迎来到天天文库
浏览记录
ID:21932062
大小:99.50 KB
页数:10页
时间:2018-10-25
《华师大数据结构期中考试试卷(含答案)》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、华东师范大学期中试卷2007—2008学年第二学期课程名称:数据结构姓名:学号:专业:年级/班级:课程性质:专业必修—•二三四五/、七八总分阅卷人签名一、单项选择题(共18分,每题3分)1.Stackhasthepropertycalledlastinandfirstout,thenwhichofthefollowingdescribesthepropertyofQueue?a)Lastinandfirstoutb)Firstinandlastoutc)Firstinandfirstout2.Alistofitemsfromwhichonlyt
2、heitemmostrecentlyaddedcanberemovedisknownasa()a)stackb)queuec)circularlinkedlistd)list3.Ifthefollowingfunctioniscalledwithavalueof2forn,whatistheresultingoutput?voidQuiz(intn){if(n>0){cout«0;Quiz(n-1);cout«1;Quiz(n-1);a)00011011b)11100100c)10011100a)01100011b)0011011.Aheapi
3、salistinwhicheachentrycontainsakey,and,forallpositionsiinthelist,thekeyatpositioniisatleaseaslargeasthekeysinpositions2i+2and(),providedthesepositionsexistinthelist.a)2ib)2i-lc)2i-2d)2i+l2.GiventherecursivefunctionintFunc(/*in*/inti,/*in*/intj){if(i<11)returni+j;elsereturnj+
4、Func(i,j-2);elsereturni+Func(i-1,j);}whatisthevalueoftheexpressionFunc(12,15)?a)81b)62c)19d)72e)noneoftheabove3.Shellsortfinallyperformanordinary()?a)Heapsortb)Insertionsortc)Selectionsortd)Quicksort填空题(共22分,每空2分)1.Ifthefollowingfunctioniscalledwithavalueof75forn,theresultin
5、goutputisvoidFunc(/*in*/intn){if(n>0){Func(n/8);cout«n%8;}}1.Givetheoutputofthefollowingprogram.【2】template〈classList_entry>voidprint(List_entry&x){cout«x«H}voidmain(){Listmylist;for(inti=0;i<5;i++)mylist.insert(i,i);cout«nYourlisthaven«mylist.size()«nelements:n«endl;my
6、list.remove(0,i);mylist.remove(2,i);mylist.insert(i,i);mylist.traverse(print);mylist.clear();for(i=l;i<3;i++)mylist.insert(i,i);mylist.traverse(print);}2.Readthefollowingprogramandfilltheblanktocompletethemethod.template〈classNode_entry>structNode{//datamembersNode_entryentr
7、y;Node*next;Node*back;//constructorsNULL,Node();Node(Node_entryitem,Node*link_backNode*link_next=NULL);};templatevoidList::set_position(intposition)const/*Pre:positionisavalidpositionintheList:0<=po
8、sition
此文档下载收益归作者所有