Module/Lecture Course: COMP42215 Introduction to Computer Science
Deadline for submission: 14:00 Friday 4th November 2022
Work returned: Week Beginning 28th November 2022
Submission
instructions:
Submit via Ultra.
Format: You should submit a single Jupyter notebook file that
contains your code and written answers. Do not put
your name on your work, just your username.
Contribution: This coursework contributes 100% to the final mark for
the module.
In accordance with University procedures, submissions that are up to 5 working
days late will be subject to a cap of the module pass mark, and later submissions
will receive a mark of zero.
Content and skills covered by the assignment:
Be able to write computer programs in python
Be able to select appropriate data structures
Be able to evaluate the complexity of an algorithm
Effective written communication
Planning, organising and time-management
Problem solving and analysis
General Requirements
You should develop an iPython (Jupyter) notebook to assess the performance and
algorithmic complexity of various algorithms using a range of data structures. Your
written answers should be at most 250 words per question.
INTRODUCTION TO COMPUTER SCIENCE 2022/2023 Masters Programmes
Section 1 (45%)
1) Write a function to generate two Python lists of the same size that contain
random integer data. The function should take as an argument the desired size of
the list. [5%]
2) Write a function that takes two Python lists as input and calculates the dot
product. That is, we are assuming that the two lists represent vectors. You should
use appropriate Python loops and no additional library functions. You should also
consider appropriate error checking. [10%]
3) Write a function to generate two NumPy arrays of the same size that contain
random integer data. The function should take as an argument the desired size of
the array. [5%]
4) Write a function that takes two NumPy arrays as input and applies the built-in
NumPy dot product. You should consider appropriate error checking. [5%]
5) Time your functions from Q2 and Q4 on an appropriate range of input sizes
(using your solutions to Q1 and Q3 to generate the inputs). Use the data you
collect to draw graphs (using matplotlib) that compare the performance of your
functions. [10%]
6) Discuss in 250 words or less what your results show. You should consider the
computational complexity of your functions. If you don’t manage to collect any
data you should research and discuss what you would expect the results to show.
[10%]
Section 2 (55%)
7) Write a function to generate an ‘n x n’ matrix of random integer data. Your matrix
variable should be an object of type “numpy.ndarray”. The function should take
as an argument the desired size of the matrix (the value ‘n’). [5%]
8) Write a function that can find the determinant of a 3 x 3 matrix. You should use
appropriate Python loops and no additional library functions. Use your function
from Q7 to generate a 3 x 3 matrix and apply this function to that matrix. [10%]
9) Write a function that takes an ‘n x n’ matrix as an argument and applies the built-
in NumPy determinant function to that matrix. [5%]
10) Write a recursive function that can find the determinant of an ‘n x n’ matrix. The
function should take an ‘n x n’ matrix as an argument. You should use
appropriate Python loops and no additional library functions. You should also
consider appropriate error checking. [15%]
Questions continue onto next page
INTRODUCTION TO COMPUTER SCIENCE 2022/2023 Masters Programmes
11) Time your functions from Q9 and Q10 on an appropriate range of input sizes
(using your solution to Q7 to generate the inputs). Use the data you collect to
draw graphs (using matplotlib) that compare the performance of your functions.
[10%]
12) Discuss in 250 words or less what your results show. You should consider the
computational complexity of your functions. If you don’t manage to collect any
data to discuss you should research and discuss what you would expect the
results to show. [10%]
Examiners will stop reading once the word limit has been reached, and work beyond
this point will not be assessed. Checks of word counts will be carried out on submitted
work. Checks may take place manually and/or with the aid of the word count provided
via an electronic submission.
You should include any relevant references that you have used in writing your written
answers, and these will not be included in the word count for the question.
PLAGIARISM and COLLUSION
Your assignment will be put through plagiarism detection services.
Students suspected of plagiarism, either of published work or work from unpublished
sources, including the work of other students, or of collusion, will be dealt with
according to Computer Science and University guidelines.