4多选以下循环队列的实现方式中,长度为n的队列,所能容纳的元素个数也为n的有:Inthefollow
4多选以下循环队列的实现方式中,长度为n的队列,所能容纳的元素个数也为n的有:Inthefollowingrealizingwaysofcircularqueue,thequeuewhoselengthisncanalsocontainthenumberofnelementsis:(Therearemorethanoneanswers.)
A.只用front和rear两个指针标记队列的头和尾,两个指针均为虚指Onlyusefrontandrearasthequeue’sheadandtailpointersandthetwopointersarevirtuallyreferringto.
B.用front和rear两个指针标记队列的头和尾,并用布尔型变量empty记录队列是否为空Withthequeue’sheadandtailpointersmarkedasfrontandrear,useBooleanvariableemptyrecordwhetherthequeueisempty.
C.只用front和rear两个指针标记队列的头和尾,两个指针均为实指Onlyusefrontandrearasthequeue’sheadandtailpointersandthetwopointersareactuallyreferringto.
D.用front和rear两个指针标记队列的头和尾,并用整型变量len记录队列元素数Withthequeue’sheadandtailpointersmarkedasfrontandrear,usetheintegervariablelentorecordthenumberofelements.
5填空编号为1,2,3,4的四辆列车,顺序开进一个栈式结构的站台;则开出车站的顺序有______种可能。注释:例如1,2,3,4或4,3,2,1就是其中两种可能出站序列;而4,3,1,2是非法序列。Numbered1,2,3,4fourtrains,orderlyenteredastackstructurestation.Howmanypossibleleavingsequencesofthatfourtrains?______.Note:Forinstance,theleavingsequencecouldbe1,2,3,4or4,3,2,1thesetwopossibilities,but4,3,1,2isnotapossiblesequence.
6填空双端队列可以在队列的两端进行插入和删除操作,既可在队尾进行插入/删除,又可在队头进行插入/删除。现有4个不同的元素顺序输入到双端队列,那么可以得到_____种不同的排列。double-endedqueuecaninsertanddeleteoperationsonbothendsofthequeue.Thatitcaninsert/deleteatitstail,butalsoatthehead.Existing4differentelementssequentiallyinputtothedouble-endedqueue,youcanget_____differentpermutations.
1单选设有两个串p和q,其中q是p的子串,求q在p中首次出现的位置的算法称为()(单选)Therearetwostringspq,qisp’ssubstring.Thealgorithmtosearchthefirsttimeqappearedinpiscalled()(Thereisonlyonecorrectanswer)
A.匹配Matching
B.联接Concatenation
C.求串长Seekinglength
D.求子串Seekingsubstring
2单选下列说法正确的是:(单选)Whichofthefollowingstatementsiscorrect?(Thereisonlyonecorrectanswer)
A.串只可以采用顺序存储,不可以采用链式存储Stringonlycanbestoredinsequentialmethodandcannotbestoredinlinkedmethod.
B.空串就是空白串“Emptystring”isblankstring.
C.在C++标准中,charS[M]最多能表示长度为M的字符串InC++standards,charS[M]canrepresentuptoastringoflengthM.
D.空串是任意字符串的子串Emptystringisasubstringofarbitrarystring.
数据结构与算法
北京大学
军职在线答案
大学网课