Another game is organized based on a number each student is assigned with. Prime numbers are the whole numbers greater than 1 that can only be divided by 1 and itself. For example, 2, 3, 5, 7, 11, 13, 17 … are prime numbers.

Assignment Task

1. This question is on graph data structure.

a. Draw a graph model to represent the daily airline routes between the following cities:

10 flights from Melbourne to Sydney and 12 in the opposite direction

4 flights from Melbourne to Canberra and 5 in the opposite direction

5 flights from Melbourne to Adelaide and 4 in the opposite direction

6 flights from Melbourne to Brisbane and 7 in the opposite direction

3 flights from Melbourne to Darwin and 3 in the opposite direction

4 flights from Melbourne to Perth and 3 in the opposite direction

4 flights from Sydney to Canberra and 5 in the opposite direction

4 flights from Sydney to Adelaide and 5 in the opposite direction

4 flights from Sydney to Brisbane and 3 in the opposite direction

3 flights from Sydney to Darwin and 3 in the opposite direction

4 flights from Sydney to Perth and 3 in the opposite direction

2 flights from Canberra to Adelaide and 2 in the opposite direction

3 flights from Canberra to Brisbane and 3 in the opposite direction

NOTE: The vertices of the graph should be the names of the cities (abbreviations are possible), the edges between vertices should represent the cities that have a flight between them (in either direction) and the weights should be the associated frequency of flights between each pair of cities. 

b. Draw the adjacency list and the adjacency matrix of the above graph. (2 marks)

c. Assuming all the return flights are not available on a certain day (i.e., all the flights listed in the opposite direction are cancelled), re-draw the graph model illustrated in part (a) above. 

d. Draw the indegree-outdegree table of the graph devised in (c), which represents the counts of the in and out degrees of each vertex of the graph.

e. A topological sort of a directed acyclic graph (a graph without cycles) represents the list of vertices of a graph such that if there is a path from vertex A to vertex B, then A appears before B. In the graph devised in part (c), how many topological orderings are there? Explain your answer with all the possible topological lists, if there are any.

NOTE: A Topological list starts with a vertex with a zero in-degree and ends with a vertex with a zero out-degree. 

2. Assume that a group of students in your class has organized an activity day full of games including rolling 6-sided dice. Answer the following questions by carefully reading the descriptions provided:

a. The students have the chance of rolling a die a multiple number of times. Assume X is the number of rolls until the first 6 appears in a successive number of rolls. What is the probability function of X?

b. Students are asked to roll a die until the sum of the numbers obtained is larger than 20. What is the probability that they can do this in 4 consecutive rolls? 

c. Suppose the students roll a red die and a green die. What is the probability that the number on the red die is larger (>) than the number on the green die?

d. When rolling 2 dice together, what is the probability that at least one die is a 6?

e. Each student is provided with a chance to roll 2 dice together. Let’s denote A = “The first die produces an odd number”, B = “The second die produces an odd number”, and C = “The sum of the two dice is odd”. Show that these 3 events are pairwise independent but not jointly independent.

3. Another game is organized based on a number each student is assigned with. Prime numbers are the whole numbers greater than 1 that can only be divided by 1 and itself. For example, 2, 3, 5, 7, 11, 13, 17 … are prime numbers. Composite numbers are the whole numbers that have more than two factors. For example, 4 has 3 factors: 1, 2, and 4. Similarly, 6 has 4 factors: 1, 2, 3, and 6. The students are asked to divide into 2 groups, PRIME and COMPOSITE, according to the assigned number.

Let PRIME(x) = student x is assigned a prime number and COMPOSITE(x) = student x is assigned a composite number. Further, let PRIME_TRIPLE(x,y,z) be that x, y, z be any tuple of students assigned with prime numbers where the sum of their numbers, i.e. (x+y+z), is also a prime number.

Analysing the above scenario of grouping and relations, produce predicate logic sentences using quantifiers and connectives for the following:

a) For all pairs of students assigned with distinct prime numbers greater than 2, there is at least one student assigned with a composite number between them.

b) There are some pairs of students assigned with distinct prime numbers that have exactly one student assigned with a composite number between them. 

c) There is a pair of students assigned with distinct prime numbers that do not have any student assigned with a composite number between them.

d) For each student assigned with a prime number, there are two other students assigned with prime numbers so that these three prime numbers together become a PRIME_TRIPLE.

e) There is a pair of students assigned with prime numbers for which we cannot find a third student assigned with a prime number to become a PRIME_TRIPLE.

f) What is the negation to the above statement in (e)? The answer must start with a quantifier and it must ot be just adding a negation symbol in front of the original statement without further explanation. 

4. Among 200 students, there are 3 types of workshops designed: Python, Java, and Maths. There are 60 students taking Python, 100 students taking Java and 90 students taking Maths. 20 students take both Python and Java and 30 students take both Java and Maths. Answer the following questions:

a. Construct a Venn Diagram for this distribution.

b. Given that a student takes at least one of the workshops, determine whether or not attending the workshops Java and Maths are statistically independent.

c. Assume that 3 students (Jane, Mark and Kate) are leading winners among all the participants. Let higher(A, B) means A has scored more than B. How can you express “Mark scored more than Kate but not more than Jane” in predicate logic?

d. Let attend(X) means X is attending the prize giving. How do you write a proposition to indicate that both Jane and Kate are not attending the prize giving?

e. Similar to (d), what is the proposition to indicate that at least one of the 3 students (Jane, Mark and Kate) will attend the prize giving ceremony? 

5. One group of students is asked to design a system to encode a short message consisting of the English alphabet for their mathematics challenge. A number is assigned to each alphabetical letter according to a predefined table (T) so that the text to be encoded can be organised into a square matrix (A) of a sequence of numbers according to the table. If the number of letters is lower than the number of elements of the matrix, the rest of the matrix can be filled with zeros. They are provided with a non-singular square matrix (C) which is used to encode the text.

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
6 2 1 5 3 4 8 11 7 18 9 20 25 13 16 10 22 15 19 23 12 17 24 14 21 26

a) Using this information, can the students retrieve the original message that has been transmitted? If your answer is YES, deduce the original message showing your workings. If your answer is NO, explain why. 

b) Two teams of students are compared to see if it is likely that the instruction each has received could have led to differing winning chances of the games they played. For the first team, a sample of 20 games yields an average winning probability of 20%. Similarly, a sample of 22 games for the second team yields a winning probability of 23%. The sample variances for the two teams are equal to 1.0 and 1.5 respectively. Justify a suitable hypothesis testing to determine the equality of the means for the case above and provide your reasoning.

c) Provided the following Huffman tree

(i). Decode the following bitstring: 11010001101110100100000001110100 

(ii). What is the compression ratio (compressed size/ uncompressed size) for the above bitstring? Assume that characters were represented by 8 bits before compression. 

(iii). Suppose another character, S, is added to the alphabet with a count of 10 occurrences. What are the changes required in the codewords when the new Huffman codes are created?