• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 6 pages
Judgments

Mathematical Techniques for Computer Science2.pdf

Document preview thumbnail
Preview 2 out of 6 pages

Mathematical Techniques for Computer S

Content preview

COMP11120


Two hours




UNIVERSITY OF MANCHESTER
SCHOOL OF COMPUTER SCIENCE




Mathematical Techniques for Computer Science




Date: Wednesday 1st June 2016
Time: 09:45 - 11:45




Please answer all THREE Questions.

Use a SEPARATE answerbook for each SECTION.

This is a CLOSED book examination

The use of electronic calculators is permitted provided they
are not programmable and do not store text




[PTO]

, COMP11120
Section A

1. a) Prove the following statement by induction: (4 marks)

n  n(n + 1) 2
∑ i3 = 2
.
i=0



b) Recall the recursively defined notion of a list over a set S, and the length function
on such lists given by

Base case len. len [ ] = 0
Step case len. len(s : l) = 1 + len l.


i) Give a recursive definition for a function rpt that takes as input a list over Z
and returns another such list, where each element of the list is repeated. The
expected output of this function for the list [2, 1, 3], for example, is
(3 marks)

[2, 2, 1, 1, 3, 3].

ii) In the notes there is a Java class List which is the direct counterpart of a
recursively defined list. For this class give a method that implements the
function described in part (i) by filling in the two return cases in the following
Java program. (3 marks)

public static List rpt (List l)
{
if (l == null)
return
else
return
}

iii) Prove by induction that for all lists l over S we have (5 marks)

len(rpt l) = 2 len l.


c) Show by induction that for all n ∈ N, (5 marks)


8n − 3n is divisible by 5.




Page 2 of 6

Document information

Uploaded on
November 1, 2023
Number of pages
6
Written in
2023/2024
Type
Judgments
$7.50

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Studyabroad
3.7
(3)
Sold
73
Followers
29
Items
1989
Last sold
2 months ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions