首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
COMP90038程序讲解、辅导Java,c++程序设计、Python编程调试 讲解Python程序|解析Haskell程序
项目预算:
开发周期:
发布时间:
要求地区:
Enrolment number (student number):
The University of Melbourne
Practice Exam Paper
School of Computing and Information Systems
COMP90038 Algorithms and Complexity
Reading Time: 15 minutes
Exam Duration: 3 hours
This paper has 11 pages, including this front page.
Authorised Materials:
None. This is a closed book exam. Electronic devices, including calculators and laptop
computers are not permitted.
Instructions to Invigilators:
Students will provide answers in the exam paper itself. The exam paper must remain in
the exam venue and must be returned to the examiner.
Instructions to Students:
This is not an actual exam paper. It is a practice paper which has been put together
to show you the format that you can expect in the exam. Many aspects of this paper’s
contents do not necessarily reflect the contents of the actual exam paper: The selection
of topics, the number of questions or sub-questions, the perceived difficulty of individual
questions, and the distribution of weights are all aspects that may be different. When
preparing for the exam, you should cover the entire syllabus and not focus only on topics
or question types used in this practice paper. If anything, the exam paper can be expected
to be harder than this practice paper.
There are 12 questions. As in the exam, you should attempt them all. Of course
your answers must be readable. Any unreadable parts will be considered wrong. You will
find some questions easier than others; in the actual exam you should allocate your time
accordingly. Marks are indicated for each question, adding to a total of 70.
The actual exam paper will be printed single-sided, so you will have plenty of space
for rough work on the flip sides. Only what you write inside the allocated boxes will be
marked. Page 11 is overflow space, in case you need more writing space for some question.
Examiners’ use:
1 2 3 4 5 6 7 8 9 10 11 12
Page 2 of 11
Question 1 (4 marks)
A. Give the names of two stable sorting algorithms, together with their worst-case time
complexities. Write the names and complexities in the box:
B. Give the names of two unstable sorting algorithms, together with their worst-case time
complexities. Write the names and complexities in the box:
Question 2 (4 marks)
We are given an array A holding n integers, for some large n. The array is sorted, and the
values in A range from -2147483648 to 2147483647, evenly distributed. Give Θ expressions
for the following tasks:
A. Running the insertion sort algorithm on the array A:
B. Running the selection sort algorithm on the array A:
C. Performing binary search for integer k which is not in A:
D. Performing interpolation search for integer k not in A:
[COMP90038] [please turn over . . . ]
Page 3 of 11
Question 3 (4 marks)
For the directed graph below, list the order in which the nine nodes are visited during a
depth-first (DFS) traversal, as well as the order in which they are visited during a breadth-
first (BFS) traversal. As always, assume that any ties are resolved by taking nodes in
alphabetical order. Write the answers in the boxes given.
DFS sequence:
BFS sequence:
Question 4 (4 marks)
Given the pattern A T G A and the text
T C A T C A T C C A T G C A C A A T G A C T T T
how many character comparisons will Horspool’s algorithm make before locating the pattern
in the text? Write the number in the box:
[COMP90038] [please turn over . . . ]
Page 4 of 11
Question 5 (4 marks)
Assume the array A holds the keys 77, 64, 15, 43, 28, 91, 80, 32, 56 in index positions 1 to 9.
Show the heap that results after application of the linear-time bottom-up heap construction
algorithm. You may show the heap as a tree or as an array.
Question 6 (4 marks)
The functions A–D are defined recursively as follows (all divisions round down, to the closest
integer):
A(n) = 2 A(n/3) + 2, with A(1) = 1
B(n) = B(n/2) + n/2, with B(1) = 1
C(n) = 512 C(n/8) + 4n2, with C(1) = 4
D(n) = 4 D(n/2) + n2, with D(1) = 2
In the following table, for each of the four functions, tick the most precise correct statement
about the function’s rate of growth:
[COMP90038] [please turn over . . . ]
Page 5 of 11
Question 7 (4 marks)
For each of A–D below, answer yes or no, and, in each case, briefly explain your reasoning
(just a justification of your answer, rather than detailed calculations). A yes/no answer that
is not justified will not attract marks, even if correct.
Question Answer/explanation
Question 8 (6 marks)
A. The box below contains a weighted undirected graph with eight nodes. Give a minimum
spanning tree for the graph. You may do that either by outlining a minimum spanning tree
on the graph itself, or by drawing the tree in the empty space next to the graph.
B. Given a weighted graph G = 〈V,E〉, a subgraph 〈V,E ′〉 (that is, E ′ ? E) which is a tree
with minimal weight is a maximum spanning tree for G.
We want a transformation of the graph G so that we can run Prim’s algorithm on the
transformed graph G′, and the algorithm will find a maximum spanning tree for G.
Describe such a (systematic) transformation from G to G′.
[COMP90038] [please turn over . . . ]
Page 7 of 11
Question 9 (6 marks)
Consider the function F below. The function takes as input an integer array A, and the size
n of A. The array indices run from 1 to n. The division used is integer division, that it, it
rounds down to the closest smaller (or equal) integer value.
In the box, give a Θ expression for the function’s time complexity.
function F(A[·], n)
s← 0
m← n
while m > 0 do
for i← 1 to m do
s← s+ A[i]
m← m/2
[COMP90038] [please turn over . . . ]
Page 8 of 11
Question 10 (10 marks)
Using pseudo-code, give an algorithm for deleting the smallest element of a binary search
tree (a BST). Assume a non-empty binary tree T has attributes T.left , T.right , and T.root
which denote T ’s left sub-tree, right sub-tree, and the key of T ’s root node, respectively.
You can use these tests if they seem useful: IsLeaf(T ) tests whether the binary tree T is
a leaf, and IsEmpty(T ) tests whether it is empty.
[COMP90038] [please turn over . . . ]
Page 9 of 11
Question 11 (10 marks)
Consider an array A of n distinct integers (that is, all elements are different). It is known
that A was originally sorted in ascending order, but A was then right-rotated r places, where
0 < r < n. In other words, the last r elements were moved from the end of the array to the
beginning, with all other elements being pushed r positions to the right. For example, for
n = 7 and r = 3, the result may look like this:
[43, 46, 58, 12, 20, 29, 34]
For r = 5, the result, based on the same original array, would be
[29, 34, 43, 46, 58, 12, 20]
You know that the given A[0..n?1] has this particular form, that is, for some r, the sequence
A[r], . . . , A[n ? 1], A[0], . . . A[r ? 1] is in ascending order, but you do not know what r is.
Design an algorithm to find the largest integer in A. Full marks are given for an algorithm
that works in time O(logn); half marks are given for a solution that is correct, but less
efficient.
[COMP90038] [please turn over . . . ]
Page 10 of 11
Question 12 (10 marks)
Two programmers face the following problem. Given an array containing n random integers
in random order, find the largest integer. The integers are placed in cells A[1] . . .A[n].
ProgrammerX has come up with the code shown below, on the left. (In the programming
language used, arrays are indexed from 0, but X ’s method does not use A[0].)
function X(A[·], n)
max ← A[1]
i← 2
while i ≤ n do
if A[i] > max then
max ← A[i]
i← i+ 1
return max
function Y(A[·], n)
i← n
while i > 0 do
A[0]← A[i]
i← i? 1
while A[0] > A[i] do
i← i? 1
return A[0]
Programmer Y has solved the same problem differently, as shown above on the right.
Compare the two solutions using three criteria: Correctness, time complexity class, and the
number of comparisons performed. Write your analysis in the box:
[COMP90038] [end of exam]
Page 11 of 11
Overflow space
Use this page if you ran out of writing space in some question. Make sure to leave a pointer
to this page from the relevant question.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
urba6006代写、java/c++编程语...
2024-12-26
代做program、代写python编程语...
2024-12-26
代写dts207tc、sql编程语言代做
2024-12-25
cs209a代做、java程序设计代写
2024-12-25
cs305程序代做、代写python程序...
2024-12-25
代写csc1001、代做python设计程...
2024-12-24
代写practice test preparatio...
2024-12-24
代写bre2031 – environmental...
2024-12-24
代写ece5550: applied kalman ...
2024-12-24
代做conmgnt 7049 – measurem...
2024-12-24
代写ece3700j introduction to...
2024-12-24
代做adad9311 designing the e...
2024-12-24
代做comp5618 - applied cyber...
2024-12-24
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!