Fill This Form To Receive Instant Help
Homework answers / question archive / Recently, automated theorem provers based on the saturation algorithm have become very powerful tools
Recently, automated theorem provers based on the saturation algorithm have
become very powerful tools.
(i) Exhibit a proof by resolution of the following formula in first-order logic.
Include the conversion into a set of clauses and provide brief justification
for each step of the proof.
∀x(P(x) → Q(x)) → (∃yP(y) → ∃zQ(z))
(a) A spy elects to use a self-synchronizing scrambler to encode his secret message.
Explain why this will not give him any privacy and why his self-synchronising
approach would be better used by a communications engineer. [5 marks]
(b) With the assistance of annotated diagrams explain CSMA/CD and CSMA/CA.
In your explanation, note the physical constraints on packets and networks that
these approaches impose. [10 marks]
(c) Consider the network buffer sizing formula B = 2T × C
(i) Explain this formula. [2 marks]
(ii) Discuss the network architecture and traffic assumptions made in the use
of this formula.
Here are four options for improving web page performance.
Option 1: HTTP Caching with a Forward Proxy
Option 2: CDN using DNS
Option 3: CDN using anycast
Option 4: CDN based on rewriting HTML URLs
You have been asked to help reduce the costs for networking in the University.
(a) The University pays its service provider networks'r'us, based on the bandwidth it
uses; bandwidth use is dominated by students downloading external web pages.
Which, if any, of the above four options would reduce the bandwidth usage?
Explain your choice. [4 marks]
(b) The delivery of online courses has become a tremendous success - but this has
led to a significant increase in network costs for the University.
You must select one of the options above to minimize load on the servers.
Compare the operation of each option and justify a selection that provides the
finest granularity of control over load to the content-servers and a selection that
will serve each customer from the closest CDN server. [12 marks]
(c) You have looked up the IP address of your favourite search engine on the
University network and noticed the answer is different from that given to your
friend when he did the lookup in Newfoundland, Canada.
For each option above, indicate why it might, or might not, be used by your
favourite search engine to improve web page performance.
The following is a quotation from an Internet forum on cryptography.
Cracking RSA is NP-complete so nothing better than brute force is
possible.
Your task is to evaluate to what extent (if any) this statement is true. For full
marks, you will consider the following questions.
• What would it mean, precisely, for "cracking RSA" to be NP-complete? In
particular, what is the decision problem involved and what is meant by saying
it is NP-complete?
• Is the problem, in fact, NP-complete? Why or why not?
• What is meant, precisely, by the conclusion, "nothing better than brute force
is possible"?
• Assuming the premise is correct, i.e. "cracking RSA is NP-complete", does the
conclusion follow? Why or why not?
• What is the relationship, more generally, between encryption systems and
NP-completeness?
[20 marks]
2
CST.2011.6.3
2 Complexity Theory
(a) Recall that a Boolean formula is in 3-CNF if it is the conjunction of clauses,
each of which is the disjunction of at most three literals. A literal is either a
variable or a negated variable.
Consider the following two decision problems:
3-SAT: given a Boolean formula in 3-CNF, decide whether or not it is
satisfiable.
3-VAL: given a Boolean formula in 3-CNF, decide whether or not it is
valid.
(i) One of the two problems above is known to be in the complexity class P.
Which one, and why? [2 marks]
(ii) Describe a polynomial time algorithm for the problem you identified in
part (i). [6 marks]
(iii) What can you say about the complexity of the other problem? State
precisely any standard results you use in your answer. [4 marks]
(b) Say that a Boolean formula is in 3-DNF if it is the disjunction of terms, each
of which is the conjunction of at most three literals.
We now consider the following two decision problems:
3-DNF-SAT: given a Boolean formula in 3-DNF, decide whether or not it
is satisfiable.
3-DNF-VAL: given a Boolean formula in 3-DNF, decide whether or not
it is valid.
What can you conclude about the complexity of these two problems?
(a) Explain how we can associate a unique number dPe to each register machine
program P. [5 marks]
(b) Consider the following two partial functions S : N * N and T : N * N on the
natural numbers.
S(dPe) = (
n if the program P when started with 0 in all registers
halts after n steps;
0 otherwise.
T(dPe) = ( n if the program P when started with 0
in all registers halts after n steps;
undefined otherwise.
(i) Which, if any, of S and T is computable and which is uncomputable?
[4 marks]
(ii) Give full justification for your answers above. State carefully any standard
results that you use. [11 marks]
4 Computation Theory
(a) State precisely what it means for a function f : N
k → N to be primitive
recursive, giving exact definitions for all operations you use. [5 marks]
(b) State precisely what it means for a function f : N
k → N to be λ-definable.
[5 marks]
(c) For each of the following functions, show (using the definitions you gave) that
it is primitive recursive and λ-definable.
(i) The function square : N → N given by square(x) = x
2
. [4 marks]
(ii) The function fact : N → N given by fact(x) = x!.
A child's toy is battery operated and has four large illuminated push buttons, a
number of smaller buttons and a loudspeaker that is used to play tunes. Production
will be 50 000 units per month for at least six months.
(a) Give a block diagram of the product, showing the principal partition decisions.
Describe the function of each block, explaining why it exists and how it should
be made. [6 marks]
(b) You may (or may not) have used a microprocessor - explain why your design
strategy is a good idea and discuss the alternative approach. [6 marks]
(c) How would you test the product concept before production? [4 marks]
(d) How would you test the product in production before shipping?
Ineed to implement in python two methods called respectively micro_precision_average and macro_precision_average below
Here is the implementation of precision:
'
import numpy as np
def precision(actualTags, predictions, classOfInterest):
'''
Calculates the precision for a specific class, given the ground truth and predicted values.
'''
totalFound = 0
for i in range(len(actualTags)):
if (actualTags[i] == classOfInterest and actualTags[i] == predictions[i]):
totalFound += 1
return totalFound / np.count_nonzero(predictions == classOfInterest)
'
we want to implement micro_precision_average below here, the description is written inside
'
def micro_precision_average(actualTags, predictions, class1, class2):
'''
Calculates the Micro-average on precisions.
- actualTags: The ground truth
- predictions: The predicted class values
- class1: The value of the first class
- class2: The value of the second class
'''
'
And macro_precision_average
'
def macro_precision_average(actualTags, predictions, class1, class2):
'''
Calculates the Macro-average on precisions.
- actualTags: The ground truth
- predictions: The predicted class values
- class1: The value of the first class
- class2: The value of the second class
'''
program to remove the first node of the list and insert it at the end.
Write a Java program that will prompt the user to input a size of an array. Create an array of type int. Ask a user to fill the array. Create a functions sortArray() and mostFrequency().
Write aprogram for dot matrix with python
write program for needleman-wunsch algorithm with python
Write recursive function that takes positive int n as its input and returns sum of the first n squares
(a) Considering either TCP/IP or UDP/IP, write a description of how server-port,
client-port, source-port and destination-port relate to each other. You may wish
to give examples and use diagrams as appropriate. [4 marks]
(b) What is a routing-loop? Include a diagram in your answer. [4 marks]
(c) Describe a mechanism that prevents routing-loops in Ethernet networks.
[4 marks]
(d) (i) Describe and, with the aid of an example, illustrate the IP Time-To-Live
(TTL) mechanism for minimising the impact of routing-loops. [2 marks]
(ii) Assuming, in part (d)(i), a perfect implementation, describe a disadvantage
of the approach including the symptoms that might be experienced in a
network subject to this disadvantage, and a test that may identify the
problem. [2 marks]
(e) Explain the technical and architectural argument behind the decision in IPv6
to retain header TTL but not a header checksum. [2 marks]
(f ) Explain why there is ambiguity about handling packets with TTL values of 1
and give a practical solution.
tackle all questions
#include <iostream>
using namespace std;
/* Link list node */
struct Node {
int data;
struct Node* next;
};
/* Function to remove the first node
of the linked list */
Node* removeFirstNode(struct Node* head)
{
if (head == NULL)
return NULL;
// Move the head pointer to the next node
Node* temp = head;
head = head->next;
delete temp;
return head;
}
// Function to push node at head
void push(struct Node** head_ref, int new_data)
{
struct Node* new_node = new Node;
new_node->data = new_data;
new_node->next = (*head_ref);
(*head_ref) = new_node;
}
// Driver code
int main()
{
/* Start with the empty list */
Node* head = NULL;
/* Use push() function to construct
the below list 8 -> 23 -> 11 -> 29 -> 12 */
push(&head, 27);
push(&head, 29);
push(&head, 21);
push(&head, 23);
push(&head, 80);
head = removeFirstNode(head);
for (Node* temp = head; temp != NULL; temp = temp->next)
cout << temp->data << " ";
return 0;
}
Step-by-step explanation
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
System.out.println("Enter the Size of array");
int size = sc.nextInt();
int [] arr = new int[size];
System.out.println("Enter the Array elements:");
for(int i=0; i<size; i++){
arr[i]= sc.nextInt();
}
sortArray(arr);
System.out.print("Sorted Array: ");
for(int i=0; i<size; i++){
System.out.print(arr[i]+" ");
}
int frequentElement = mostFrequent(arr);
System.out.println("\nMost Frequent Element is: "+ frequentElement);
}
// sortArray() function which uses Bubble sort Algorithm to sort the elements.
public static void sortArray(int arr[])
{
for (int i = 0; i < arr.length; i++)
{
for (int j = 0; j < (arr.length - 1 - i); j++)
{
//if left value is great than right value
if (arr[j] > arr[j + 1])
{
//swap values
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}
// mostFrequent() method which returns most frequency element in array.
public static int mostFrequent(int arr[])
{
// find the max frequency using linear traversal
int max_count = 1, res = arr[0], curr_count = 1;
for (int i = 1; i < arr.length; i++) {
if (arr[i] == arr[i - 1])
curr_count++;
else {
if (curr_count > max_count) {
max_count = curr_count;
res = arr[i - 1];
}
curr_count = 1; }
}
// If last element is most frequent
if (curr_count > max_count)
{
max_count = curr_count;
res = arr[arr.length - 1];
}
return res;
}
}