Describe how to assign Godel numbers to -terms and explain the notation pMq. Describe an application of
Question:
Describe how to assign Godel numbers to -terms and explain the notation pMq. Describe an application of these techniques. [3 marks] Present a -term iszero, such that iszeropMq = true if M = 0 false if M 6= 0 or prove that no such term exists. [7 marks] 4 CST.93.5.5 10 Computation Theory Show that there is no way of deciding by algorithms whether a general register machine program with code p will terminate when started with initial data of 0 in every register. [10 marks] Show that there is no way of deciding by algorithm whether the blank character will be printed during the course of a general Turing machine computation. [10 marks] Note: any standard form of the undecidability result for the general halting problem may be assumed, but should be stated clearly. 11 Complexity Theory Explain how to measure the size of a problem in complexity theory. [3 marks] What is meant by reducing one problem to another? [4 marks] Given that the Boolean Satisfiability Problem is NP-complete, show that the Hamiltonian Circuit Problem for undirected graphs is also NP-complete
A picnicker brings hot black coffee and cold milk in two identical insulated flasks and then mixes them for his drink. His friend claims that the drink would have ended up the same temperature if he had mixed the two at home and brought one flask. Note: The temperature of an object is the heat energy within it divided by its heat capacity. The rate of heat energy flow from a hotter to a cooler object is their temperature difference divided by their insulation resistance. When two fluids are mixed the resultant temperature is the sum of their initial temperatures weighted by their proportions. (a) Give a suitable state vector for a simple, finite-difference, time domain simulation of the drink system. [3 marks] (b) List the initial values and any other parameters that are needed for the simulation. Sketch pseudocode for each of the two scenarios. Assume constant ambient temperature and state any further assumptions. [7 marks] (c) How would you select a fixed time step for these two simulations or should the time steps be adaptive? What accuracy might you expect to achieve? Is the choice of time step likely to affect whether the friend is proved right or wrong? [3 marks] (d) Suppose the two-flask simulation were phrased in flow-matrix form. What determines how many rows the matrix would have? Is this a sensible approach to modelling the system? [4 marks] (e) Why is backwards stability normally a useful property of numerical methods? Does that notion apply to this simulation? [3t segments on the real axis. (a) Write a Dab class in Java that supports equality testing between two dabs in linear time. Provide only the data members without any constructors or methods, and highlight any noteworthy features and invariants. Note: You may not use any pre-made lists, resizable arrays or other library collections of any kind; use only integers, doubles, pointers, arrays and classes. You are allowed to define additional classes if necessary. [4 marks] (b) Draw a records-and-pointers diagram representation of the following dab {(2.3, 1),(10, 24.53),(2, 6)} using your class from part (a). [2 marks] (c) Given a set S of dabs, find an algorithm that returns a dab of maximum cardinality containing only segments from the dabs in S. The algorithm should run in O(n 2 ) time, where n is the total number of segments of all dabs contained in S. (i) Clearly describe and explain your algorithm. [4 marks] (ii) Describe your algorithm in a few lines of pseudocode. [4 marks] (iii) Prove that your algorithm is correct.
import java.util.*;
public class StockPriority{
public static void main(String args[]){
PriorityQueue
//initialize the PriorityQueue with values
stock_queue.add("001 Rice");
stock_queue.add("002 Bike");
stock_queue.add("003 Cooking Oil");
stock_queue.add("004 Television");
stock_queue.add("005 Laptop");
System.out.println(" PriorityQueue item sequence:");
Iterator iter=stock_queue.iterator();
while(iter.hasNext()){
System.out.println(iter.next() + " ");
}
}
}
How to change this code for a stock exchange stocks on the Stock Market
ensure to answer all questions
Suppose that F() is the Fourier transform of the function f(x). (a) State the integral expression for F() in terms of f(x) and the inverse transform for f(x) in terms of F().
A positive integer is a prime number if its only positive integer divisors are itself and 1. Write a program to determine whether or not a given integer is prime
Writing x for the relative error in x, what is the worst-case relative error in evaluating x 2 ? What is the worst-case absolute error? What is the worst-case absolute error in evaluating x 2 y 2 ?
Write function, printdixisors, that takes a single integer parameter and prints all the numbers less that the parameter that are divisors of the parameter
Write function that takes an integer input n as a parameter and after it calculates the sum of 1+2+3+...+n, it returns the value to the main program
Write function that takes as an input parameter an integer that will represent the length of the array and a second integer that represents the range of numbers the random number should generate
Write program that asks the user for a lower limit and an upper limit. The program finds all pairs of amicable numbers where the first number of the pair is between those limits. The second number of the pair may or may not be between the limits.
* This enumeration groups the names of constants representing the sortable attributes of Book * objects. */ public enum Attribute { TITLE, AUTHOR, PAGECOUNT, ID; }
Here is theLinkedNodeClass:
public class LinkedNode
//constructors public LinkedNode(T data) { this.data = data; }
public LinkedNode(T data, LinkedNode
} //accesors getNext() getData() and toString() public LinkedNode
//mutator public void setNext(LinkedNode
/** * The ID value for this Book. */ public final int ID;
public Book(String title, int pageCount) { if (pageCount <= 0) throw new IllegalArgumentException("Invalid page count"); this.title = title; this.pageCount = pageCount; this.ID = idGenerator++; // set defaults for an anonymous book this.authorFirstname = ""; this.authorLastname = ""; }
public Book(String title, int pageCount, String last, String first) { this(title, pageCount); this.authorFirstname = first; this.authorLastname = last; }
/** * Accessor for the author value * @return the author of this Book, as "Lastname, Firstname" */ public String getAuthor() { return authorLastname+", "+authorFirstname; }
/** * Accessor for the title value * @return the title of this Book */ public String getTitle() { return this.title; }
/** * Accessor for the pageCount value * @return the number of pages in this Book */ public int getPageCount() { return this.pageCount; public int compareTo(Book otherBook, Attribute a) { switch(a) { case ID: return this.ID-otherBook.ID; case TITLE: return this.title.compareTo(otherBook.title); case AUTHOR: return this.getAuthor().compareTo(otherBook.getAuthor()); case PAGECOUNT: return this.pageCount-otherBook.pageCount; default: return 0; } }
public String toString() { return this.ID+": \""+this.title+"\", "+this.getAuthor()+" ("+this.pageCount+")"; }
public static void resetGenerator() { idGenerator = 0; }
}