COS30008 - 2021 Final Exam Questionnaire
COS30008 - 2021 Final Exam Questionnaire
Markus Lumpe
Wed Wed Wed Thurs Thurs Thurs Thurs Fri Fri Fri
Check
08:30 10:30 16:30 08:30 10:30 14:30 16:30 08:30 10:30 14:30
Tutorial
Marker's comments:
Time Estimate
Problem Marks Obtained
in minutes
1 50 20
2 54 15
3 42 10
4 60 15
5 8+128=136 60
This test requires approx. 2 hours and accounts for 50% of your overall mark.
This sort of tree may be formed by following the set of rules outlined below:
(i)For i>=0, the maximum number of nodes at level I is 2^i.
(ii) The greatest number of all nodes in a tree of height h is 2^(h+1)-1, while the
1a) minimum number is 1.
Following the application of these criteria, we design a tree in which all subtrees
have the same degree.
b. What are reference data members and how do we initialize them? (2 marks)
To refer to items that are outside of this class's domain. The constructor initializer
list can be used to initialize them.
1b)
Depending on the class's composition, an object adapter covers both the class
and its interface. The object source is included in order to expand the interface of
the original source.
1d)
The data type's visual representation is known as the user interface. Provides the
ability to alter the data type through the implementation.
1e)
It may be done by utilizing the class's forward declaration. The idea of advance
declaration of class might be used.
1f)
h. What is the difference between copy constructor and assignment operator and how do
we guarantee safe operation? (8 marks)
- Stack-allocated variables.
- Possesses an assignment operator that copies other variables to itself.
-There is no correlation between changes in one variable and changes in the
1h) value of another.
-Copy constructors are available, allowing for the creation of duplicates of other
variables.
i. What is the best-case, average-case, and worse-case for a lookup in a binary tree?
(6 marks)
- best-case is O(1)
- average-case is O(logn)
- worse-case is O(n)
1i)
j. You are given a set of n-1 numbers out of n numbers. How do we find the missing
number nk, 1 ≤ k ≤ n, in linear time? (8 marks)