浙江大学20072008学年秋季学期
《数据结构基础》课程期末考试试卷
开课学院:软件学院、计算机、竺可桢学院考试时间:_2007_年_11_月_17日考生姓名:题序得分评卷人一___学号:二三,考试形式:闭卷,允许带_无入场
所需时间:120分钟专业:四____教师:总分
A
swerSheetPartI1c6b2a7a3d8bPartII14d9b5c10c
2
HEleme
ts1ChildHSizeHEleme
tsChild1HEleme
tsChildHEleme
tsiHEleme
tsChild
3
jI
creme
t
ThisSumAj
TmpAjI
creme
t
ThisSum0
PartIII1aABEDHIFCGJ1c
DA4E23H154IJ4FB7C4G
bABDEHFICGJ
f2a
40
2b
282863388091726
100
40
100
38
8091
3
40
or
2863389180
100
3
242255695
4aBuildmaxheapa
dcallDeletMaxforktimesONklogNKeepami
heapofkeleme
tsComparea
eweleme
twiththeroota
dDeletMi
a
dI
sertthe
eweleme
tifthe
ewo
eislargerONlogkSorta
dtakethekthlargestONlogNTakeapivota
dpartitio
thesetasi
QuicksortIfkS2the
theeleme
tmustbei
S2recursivelyfi
ditfromS2IfkS21the
retur
thepivotIfkS2the
it’si
S1a
dit’stheS1Nkthlargesteleme
tRecursivelyfi
ditfromS1AverageONWorstON2
4b
fPartIV
voidDijkstraTableTTCou
tisi
itializedtobe0TstartCou
tTstartballoo
vertexvwforvsmallestu
k
ow
dista
cevertexifvNotAVertexbreakTvK
ow
Trueforeachwadjace
ttovifTwK
ow
ifTvDistCvwTwDistDecreaseTwDisttoTvCvwTwPathvTwCou
tTvCou
tTwballoo
elseifTvDistCvwTwDistTvCou
tTwballoo
TwCou
tTwCou
tTvCou
tTwballoo
TwPathvDONOTforgetthis
fNOTEPleasewriteyoura
swerso
thea
swersheet注意:请将答案填写在答题纸上。
IPleaseselectthea
swerforthefollowi
gproblems20poi
ts
1Thetimecomplexityofthefollowi
gpieceofcodeis2poi
tsfori0i
iforjij0j2pri
tf“d
”jaO
bO
cO
log
dO
i2Supposethatthetimecomplexitiesoftwoprogramsaregive
byT1NOfNa
dT2NOfNWhichofthefollowi
gequatio
sistrue2poi
tsaT1NT2NOfNbT1NT2NofNcT1NT2NO1dT1NOT2N3Give
a
emptystackSa
da
emptyqueueQAlistofcharactersarepushedi
toSi
theorderofabcdefa
deverycharacterthatispoppedfromSwillbei
sertedi
toQimmediatelyIftheoutputofQisbdcfeathemi
imumcapacityofSmustbe2poi
tsa6b5c4d34Supposethatthesizeofahashtableis11a
dthehashfu
ctio
isHr