You are on page 1of 12

CLASS TEST 3 (online equivalent-turnitin assessment)

COURSE CODE AND TITLE: MATH2081 MATHEMATICS FOR COMPUTING


Topics Covered: Graphs, Trees, Probabilistic Logic

Candidate’s Family Name: Candidate’s Given Name:

Candidate’s Student No.:

Any special circumstances e.g. other RMIT study activity taking place today, please
include: Course Name; Code; Staff Member name; Times of activity

INSTRUCTIONS
In this assessment you CAN use online calculators and hand held calculators. However
you must show full citations and references for each online tool and resource used.
You must show how a manual solution can be reached, and explain the process.

For example:
Convert 1000 into a binary number: 1111101000 (RapidTables.com, date unknown)

Method (Division by the targetted base, in this case base 2 [binary])

1. Divide the number to be converted by 2.


2. Get the quotient for the next step.
3. Get the remainder for the binary digit (0 or 1)
4. Repeat the steps until the quotient is equal to 0.

process quotient remainder/binary digit


1000/2 500 0
500/2 250 0
250/2 125 0
125/2 62 1
62/2 31 0
31/2 15 1
15/2 7 1
7/2 3 1
3/2 1 1
1/2 0 1
I did not use an online source

Reference:
RapidTables.com (date unknown) url:
https://www.rapidtables.com/convert/number/decimal-to-binary.html Accessed 7th April
2020
Crellin J. (2020) RMIT University url:
CLASS TEST 3
(online equivalent-turnitin assessment)

COURSE CODE AND TITLE: MATH2081 MATHEMATICS FOR COMPUTING


Topics Covered: Sums and Functions; Recursion; Hash functions; Sets

Candidate’s Family Name: Nguyen Candidate’s Given Name: Dung


Hoang

Candidate’s Student No.:


s863900
Any special circumstances e.g. other RMIT study activity taking place today, please
include: Course Name; Code; Staff Member name; Times of activity

INSTRUCTIONS
In this assessment you CAN use online calculators and hand held calculators. However
you must show full citations and references for each online tool and resource used.
You must show how a manual solution can be reached, and explain the process.

For example:
Convert 1000 into a binary number: 1111101000 (RapidTables.com, date unknown)

Method (Division by the targetted base, in this case base 2 [binary])

1. Divide the number to be converted by 2.


2. Get the quotient for the next step.
3. Get the remainder for the binary digit (0 or 1)
4. Repeat the steps until the quotient is equal to 0.

process quotient remainder/binary digit


1000/2 500 0
500/2 250 0
250/2 125 0
125/2 62 1
62/2 31 0
31/2 15 1
15/2 7 1
7/2 3 1
3/2 1 1
1/2 0 1
I did not use an online source

Reference:
RapidTables.com (date unknown) url:
https://www.rapidtables.com/convert/number/decimal-to-binary.html Accessed 7th April
2020
Crellin J. (2020) RMIT University url:
a) SECTION 1 Mathematical Principles, Method and context (50%)
In the following questions remember to cite and reference online sources used
A. Graphs (15 points)
The following is a graph showing eight cities in the United Kingdom, namely Manchester;
Edinburgh; Exeter; Scarborough; Birmingham; Bath; Portsmouth; and London. The vertices are
the cities and there is a cost in going from one city to another connected city.

1. Label the vertices of this graph such that no two


adjacent vertices have the same label (e.g.colour
or whatever you like) . Write the labels beside the
vertices on the graph. The number of labels
should be kept at a minimum. (use number labels)
Edinburgh: 1
Scarborough: 2
London: 3
Birmingham: 4
Portsmouth: 5
Bath: 6
Exeter: 7
Manchester: 8

2. Is there an Eulerian trail within the graph?


If yes, write the sequence of vertices that form the Eulerian trail, ex: Manchester;
Edinburgh; Exeter… If no, tell the reason why? (3 points)
They are all Eulerian circuit because we can come and back between edges.
3. Is there a Hamiltonian trail within the graph? If yes, write the sequence of vertices that
form the Hamiltonian trail, ex: Manchester; Edinburgh; Exeter… If no, tell the reason why?

The Hamiltonian trail I found on this graph is Exeter, Manchester, Edinburgh,


Scarborough, Birmingham, London, Portsmouth, Bath, Exeter.
4. What is the shortest path between city Manchester and London? Write the sequence of
vertices along the shortest path, ex: Manchester; Edinburgh; Exeter… (3 points)
The shortest path is Manchester, Exeter, Bath, Portsmouth, London.
5. For the traveling salesman, what is the best route that will cover all 8 cities and come back to
the first city? Ex: Manchester; Edinburgh; Exeter…… You will be expected to cite and reference
sources.
Exeter, Manchester, Edinburgh, Scarborough, London, Portsmouth, Birmingham, Bournemouth,
Exeter (Cost: 1300)
Cite sources: https://www.geeksforgeeks.org/travelling-salesman-problem-set-1/
B. Trees(20 points)

Given the following algebraic expression,


(20 + 4*6) / (3^4 - 6)
1. Construct the binary expression tree that will be used to evaluate the expression.

2. Using the pre-order traversal of this tree, what is the prefix expression of this tree?
Prefix: / + 20*4 6 - ^ 3 4 6
3. Using the in-order traversal of this tree, what is the infix expression of this tree?
(2 points)
Infix: 20 + 4 * 6 / 3 ^ 4 - 8
4. Using the post-order traversal of this tree, what is the postfix expression of this tree?
(2 points)
Postfix: 20 4 6 * + 3 4 ^ 8 - /
4. Show the steps of how a computer would evaluate the postfix expression.
(3 points)

* ^ -
4 + 4 6 /
6 24 20 3 81 81 75 42
20 20 24 44 44 44 44 44 44 44/75

6. Given the frequencies of characters:


Character Frequency
A 8
B 3
E 10
Y 6
T 3
N 3
P 1
I 1
R 5
C 4
Construct the Huffman tree that could be used to encode data...
7. Using the Huffman Tree you constructed above, encode the message "CANTERBERRYPIE".
(2 points)
C A N T E R B E R R Y P I E
010 100 1100 1101 101 001 111 101 001 001 000 0110 0111 101
8. Using Huffman encoding, how many bits were used to encode the message
"CANTERBERRYPIE100" ? On the average, how many bits were used per character?
45 bits total.
45/14 = 3.21428571429 in 1 character
C. Discrete Probabilities (15 points)

Given the following collection of Spam and Ham email:


Collection of Spam email
1. Labor Day Sale ! Latest Courses On Sale
2. Get 28% Off, Learn Japanese with Your Own Teacher & Fast, Easy Lessons
3. Congratulations! You have won a big prize!
4. 1 Cup tomorrow morning, burns 3 lbs of belly fat
5. New promotion!!! Buy 1 get 1, pay 2.
6. Lazada voucher
7. Giam Gia Mua 1 Tang 1
8. Your computer is seriously infected. Try this antivirus for free!
9. Discount on your next game download
10. Free trip to Malaysia
11. HOT!!! USB SanDisk 16G gia chi 99K!
12. Free all-you-can-download movies
13. Maldives for only 10 million!
14. Free trip to Europe
15. Free windows 10 download
16. Free viagra for every $10 purchase
17. Hack to rival’s account with this tool.
18. Free computer scan. Get your results now, not tomorrow.
19. Get online bank loan.
20. Make your own website. Your free account is waiting for you.

Collection of Ham email


1. Leave Requests for next Monday 29th April
2. [outage notification] All building inspections by Airmaster contractor
3. Please meet me 2:30pm at my office. Thanks.
4. Here is your test result
5. Your registration for the game has been confirmed.
6. You have been invited to a job interview at 3p.m. tomorrow.
7. 1am, room 414, bring your all stuff
8. Your bank account balance is 100000vnd
9. We need to talk, hope you are free this lunch. Sign: Wife
10. Congratulations on your new car! Party tomorrow?

Given the conditional probability for classifying an email as spam:


1. Calculate the following probabilities.
(2 points)
P["free" / spam] = 8/20 = 2/5
P[spam] = 20/(20 + 10) = 2/3
P["free"] = 9/(20 + 10) = 3/10
P[spam / "free"] = 8/9 = 0.89

Suppose you get a new Spam email in your Inbox:


"[VIDEO] Free Training Teaches You Elliott Wave Strategy!"

You have three choices: (1) Delete the email (2) Report it as spam or (3) Ignore
Compute P[spam / "free"] after making each choice.

2. You chose "Delete the email".


(2 points)
P[spam / "free"] = 8/9

3. You chose "Report it as spam".


(2 points)
P[spam / "free"] = 9/10

4. You chose "Ignore".


(2 points)
P[spam / "free"] = 4/5

The Rock-Paper-Scissors program maintains a table of frequencies from which it computes the
discrete conditional probability Prob( Next move / Previous move). After playing for a while
against a person, the table of frequencies of the person's moves is as follows:

Next is Paper Next is Scissors Next is Rock


Previous is Paper 3 7 2
Previous is Scissor 6 0 4
Previous is Rock 7 5 6

5. Given that the person's previous move was Scissors, (2 points)

P(Scissor/Paper) = 6/10 (This is the highest probability)


P(Scissor/Scissor) = 0/10
P(Scissor/Rock) = 4/10

6. Given the table above and that the person’s previous move was Rock, and his next 20
moves were (5 points)
PRPP SPPR SPRP PSPR PSPR
where "R" is Rock, "P" is Paper and "S" is for Scissors.
Update the table of frequencies:
Next is Paper Next is Scissors Next is Rock
Previous is Paper 6 10 7
Previous is Scissor 10 0 4
Previous is Rock 11 6 6
P(Rock/Paper) = 11/23 (This is the highest probability)
P(Rock/Scissor) = 6/23
P(Rock/Rock) = 6/23

Next computer move is Scissor.

SECTION 2 Application of Mathematical Principles (50%)

You can choose EITHER of the two below:

A) Research and describe the algorithms used in Huffman encoding, and one other data
compression algorithm, of your choice. Guide: In your answer you should use between 2 and 6
sources. Your answer should not be longer than 1000 words (about one/two pages). Sources
(on or off line) must be cited and referenced correctly. You must use your own words, or clearly
show text that has been sourced externally as a quotation. The assessment will be assessed via
the TurnItIn tool. You will be expected to cite and reference sources.

OR

B)Take one of the topics discussed in the final part of the course (trees, graphs and discrete
probabilities), and describe at least two application areas where that topic is employed in
computing to solve problems. Instances you may find there are interesting professional/ethical
areas where In some I expect you to research the topic online. Guide: In your answer you
should use between 2 and 6 sources. Your answer should not be longer than 1000 words (about
one/two pages). Sources (on or off line) must be cited and referenced correctly. You must use
your own words, or clearly show text that has been sourced externally as a quotation. The
assessment will be assessed via the TurnItIn tool. You will be expected to cite and reference
sources.

END

I have learnt many things about encoding and I find that they are very interesting to do research
about it. I want to do research about the algorithms use in Huffman encoding and lossless data
compression algorithms.

Huffman encoding is an algorithm which is mainly use in computer science and information
theory. This encoding way has been developed by David A. Huffman when he still studying at
MIT. The reason for this creation is that Huffman and his teammates have to choose between a
term paper or a final exam for his courses. In addition, their professor Robert M. Fano, ask them
to find the most efficient binary code problems. However, he can’t prove which of them is the
most efficient so he starts to give up and study for the final exam. Surprisingly, he has an idea of
using a frequency-sorted binary tree to describe and find the result he has expected. After that,
Huffman method has been approved by many experts and being using widely around the world.
Huffman method has a specific method in presenting the symbols by showing them in a prefix
code and the particular symbols is never present in the same bit string. Therefore, Huffman
encoding become so popular even the code is not created by using Huffman algorithms. The
simple way to using Huffman algorithms are using a priority queue where the highest priority is
the node has lowest probability. First, create a leaf node which is present for each symbol and
then add it to the queue that you have. If there is more node in the queue, you should remove
two highest priority node and replace them with the node that have the probability is equal the
sum the two node’s probability. At last, the code remain is the root code and the tree will be
complete.

Lossless data compression is the method to show the data without losing any of it by using
exploit statistical redundancy. Therefore, we can reverse the data at any time easily. Because of
the real-world data are usually represent in statistical redundancy. For instance, we all know that
the picture has a specific area of colour that doesn’t change even we change pixels. That is
because the code has been present at “345 blue pixels” instead of “blue pixel, blue pixel, …”.
Therefore, we can cut down the amount of time we use to coding. Now, people use probabilistic
models because it is very strong at data compression. Huffman algorithms is also a method use
to reinforce the lossless data compression.

In my opinion, I think that the lossless data compression is veery important in computer science
and we should understand it more. In addition, Huffman algorithms is also a fascinating method
that we should also know because it involved a lot with lossless data compression.

You might also like