Discuss the following concepts in Kolmogorov's theory of pattern complexity: how writing a program that generates a
Question:
Discuss the following concepts in Kolmogorov's theory of pattern complexity: how writing a program that generates a pattern is a way of compressing it, and executing such a program decompresses it; fractals; patterns that are their own shortest possible description; and Kolmogorov incompressibility.ile ato monitor the use of its spaces (both outdoor and indoor), its energy efficiency and the comfort of its students. In particular, the college has invested in temperature sensors, light sensors and movement sensors, all equipped with WiFi and Zigbee radio chips (assume the college has a WiFi network in place already). The college council has, however, prohibited the installation of permanent wires for powering the sensors in the interest of period building preservation. (a) Descrie architecture for the wireless sensor network system you would put in place on behalf of the college, illustrating the physical components and the communication infrastructure. [3 marks] (b) Select a wireless sensor network MAC protocol for this network and explain why you have chosen it. [3 marks] (c) Describe the Directed Diffusion protocol and illustrate how the protocol can be applied in the wireless sensor network of Duke of Cambridge College. [5 marks] (d) Now assume that due to connectivity limitations and the extension of the college grounds, a group of nodes of the wireless sensor network cannot be connected to the rest of the network, nor the college Internet. The data generated by these nodes, however, is vital but not time critical. Explain how you would handle the data harvesting for this portion of the network through the use of a delay tolerant networking approach. [4 marks] (e) After the first roll-out of the pilot study, a bright student suggests that a mobile phone application could be released to allow willing students who want to install it on their smartphones to contribute data about their use of college space. Explain what salient features the application would need to have and how it would be able to detect the student's use of space (mainly location and activity) and transmit the data back to the college system.
public class SandwichMaker
{
private String name;
private Sandwich currentSandwich;
private String[] availableIngredients;
private Cashier cashier
public SandwichMaker(String name, String[] availableIngredients, Cashier cashier) {
this.name = name;
this.availableIngredients = availableIngredients;
this.cashier = cashier;
}
public void makeSandwich(Customer customer, String sandwichVariety) {
currentSandwich = new Sandwich(sandwichVariety);
for (String ingredient : availableIngredients) {
promptIngredient(customer, ingredient);
}
passSandwich(customer);
}
public void promptIngredient(Customer customer, String ingredient) {
// if the customer wants the specified ingredient, then add it to the sandwich
if (customer.chooseIngredient(ingredient)) {
currentSandwich.addIngredient(ingredient);
}
}
public void passSandwich(Customer customer) {
// give the sandwich to the cashier to ring up
cashier.ringUpSandwich(customer, currentSandwich);
}
}
public class Sandwich {
private String variety;
private ArrayList
public Sandwich(String variety) {
this.variety = variety;
ingredients = new ArrayList
}
public void addIngredient(String ingredient) {
ingredients.add(ingredient);
}
public String getVariety() {
return variety;
}
public ArrayList
return ingredients;
}
}
public class Customer
{
private String name;
private double cash;
private String[] desiredSandwiches;
private String[] desiredIngredients;
public Customer(String name, double cash, String[] desiredSandwiches, String[] desiredIngredients)
{
this.name = name;
this.cash = cash;
this.desiredSandwiches = desiredSandwiches;
this.desiredIngredients = desiredIngredients;
}
public void orderSandwich(SandwichMaker sandwichMaker)
{
for (String sandwich : desiredSandwiches)
{
sandwichMaker.makeSandwich(this, sandwich);
}
}
public boolean chooseIngredient(String ingredient)
{
boolean answer = false;
for (String desiredIngredient : desiredIngredients)
{
if (desiredIngredient.equalsIgnoreCase(ingredient))
{
answer = true;
}
break;
}
return answer;
}
public boolean givePayment(double total)
{
boolean answer = false;
// Check if customer has enough cash to pay
if (cash >= total)
{
cash -= total;
answer = true;
}
return answer;
}
}
import java.util.ArrayList;
public class Cashier
{
private String name;
private Sandwich currentSandwich;
private Customer currentCustomer;
private double cash;
public Cashier(String name, double cash)
{
this.name = name;
this.cash = cash;
}
public void ringUpSandwich(Customer customer, Sandwich sandwich)
{
currentSandwich = sandwich;
currentCustomer = customer;
computeTotal();
}
public void computeTotal()
{
double total = 0;
// Check each sandwich variety for a match to currentSandwich
for(SandwichVariety variety : SandwichVariety.values())
{
if (currentSandwich.getVariety().equalsIgnoreCase(variety.getName()))
{
total = variety.getPrice();
break;
}
}
ArrayList
// Check each ingredient for a match to sandwichIngredient
for (String sandwichIngredient : sandwichIngredients)
{
for (Ingredient ingredient : Ingredient.values())
{
if (ingredient.getName().equalsIgnoreCase(sandwichIngredient))
{
total += ingredient.getPrice();
break;
}
}
}
// Check if the customer can afford to pay
if (currentCustomer.givePayment(total))
{
cash += total;
}
System.out.println("Total: " +total);
}
}
public class Main
{
public static void main(String[] args)
{
Cashier cashier = new Cashier("Williams", 0);
Customer customer = new Customer("Ryan", 0,
new String[] {"BLT", "Tasty"},
new String[] {"Cheese", "Guacamole"});
SandwichMaker sandwichMaker = new SandwichMaker("Daniel",
new String[] {"Cheese", "Gherkins", "Meatballs"}, cashier);
customer.orderSandwich(sandwichMaker);
System.out.println();
}
}
step by step and ensure toanswer all questions
Write program that uses function strncmp to compare two strings input by the user. The program should input the number of characters to be compared, then display whether the first string is less than, equal to, or greater than the second string.
Write program thet uses the function strcmp() to compare two strings input by the user. The program should state whether the first string is less then, equal to, or greater then the second string
Write recursive function that uses the strchr() function to display the number of occurrences of a character inside a string. Create a C program to read string of less than 10 characters and a character and calls the function.
Write recursive method to return the number of occurrences a character c in a string s. c and s should be parameters.
complet the traversal method in the Tree234Impl. This should be an inorder traversal of the tree.
Tree234Impl.java
package tree234impl;
public class Tree234Impl {
public static void main(String[] args) {
Node n = new Node();
n.insertItem(new Data(34));
n.insertItem(new Data(12));
n.display();
n.removeItem();
n.display();
//System.out.println(n.findItem(12));
}
}
Tree234.java
package tree234impl;
public class Tree234 {
Node root = new Node();
public int find(int key){
Node curr =root;
int childNum;
while(true){
childNum = curr.findItem(key);
if(childNum != -1) //found in the root node
return childNum;
else if(curr.isLeaf()) //not found and is leaf
return -1;
else{
curr = getNextChild(curr,key);
}
}
}
public Node getNextChild(Node curr, int key){
int i;
int numItems = curr.numItems;
for(i = 0 ; i < numItems; i++){
if(key < curr.getItem(i).num)
return curr.getChild(i);
}
return curr.getChild(i);
}
public void split(Node curr){
//assumption is that curr is a full node
Data itemB , itemC;
Node parent, child2, child3;
itemC = curr.removeItem();
itemB = curr.removeItem();
child2 = curr.disconnectChild(2);
child3 = curr.disconnectChild(3);
Node newRight = new Node();
if(curr == root){
root = new Node();
parent = root;
root.connectChild(0, curr);
}
else
parent = curr.parent;
//deal with parent
int itemIndex = parent.insertItem(itemB);
int n = parent.numItems;
for(int i = n-1; i > itemIndex ;i++){
Node temp = parent.disconnectChild(i);
parent.connectChild(i+i, temp);
}
parent.connectChild(itemIndex+1, newRight);
newRight.insertItem(itemC);
newRight.connectChild(0, child2);
newRight.connectChild(1, child3);
}
public void insert(int value){
Node curr = root;
Data newData = new Data(value);
while(true){
if(curr.isFull()){
split(curr);
curr = curr.parent;
curr = getNextChild(curr, value);
}
else if(curr.isLeaf()){
break;
}
else
curr = getNextChild(curr,value);
}
curr.insertItem(newData);
}
}
Node.java
package tree234impl;
public class Node {
final static int MAX_KIDS = 4;
int numItems;
Node parent;
Node[] childArray = new Node[MAX_KIDS];
Data[] items = new Data[MAX_KIDS - 1];
public void connectChild(int childNum, Node child) {
childArray[childNum] = child;
if (child != null) {
child.parent = this;
}
}
public Node disconnectChild(int childNum) {
Node temp = childArray[childNum];
childArray[childNum] = null;
return temp;
}
public Node getChild(int childNum) {
return childArray[childNum];
}
public boolean isLeaf() {
return childArray[0] == null;
}
public Data getItem(int index){
return items[index];
}
public boolean isFull(){
return numItems == MAX_KIDS -1;
}
public int findItem(int key){
for(int i = 0; i < items.length; i++){
if(items[i] == null)
break;
else if(items[i].num == key)
return i;
}
return -1;
}
public int insertItem(Data newItem){
numItems++;
int newKey = newItem.num;
for(int i = items.length-1 ; i >= 0 ; i--){
if(items[i] == null)
continue;
else{
if(newKey < items[i].num)
items[i+1] = items[i];
else{
items[i+1] = newItem;
return i+1;
}
}
}
items[0] = newItem;
return 0;
}
public Data removeItem(){
Data temp = items[numItems-1];
items[numItems-1] = null;
numItems--;
return temp;
}
public void display(){
for(int i = 0 ; i < numItems ;i++){
System.out.println(items[i].num);
}
}
}
Data.java
package tree234impl;
public class Data {
int num;
p(a) What are the usage and the limitations of the Bootstrap technique in phylogeny? [6 marks] (b) We often use Hidden Markov Models (HMM) to predict a pattern (for instance the exons). How can you compute the number of True Positives, True Negatives, False Positives and False Negatives and use them to evaluate your HMM? [6 marks] (c) How can you evaluate the results obtained (number of clusters and their relative position) using the K means algorithm for clustering? [5 marks] (d) What is the difference between the adjacency list and the accessibility list? [3 marks] 2 CST.2013.9.3 2 Computer Systems Modelling (a) Define a Poisson process of rate λ > 0. [3 marks] (b) Show that the number of events, N(t), of a Poisson process that occur in the fixed time interval [0, t] is a random variable that has a Poisson distribution with parameter λt. [3 marks] (c) Show that the inter-event times of a Poisson process form a sequence of independent random variables each distributed with an exponential distribution with parameter λ. [3 marks] (d) Describe how to use the inverse transform method to simulate exponential random variables with parameter λ. [3 marks] (e) Show how your simulated exponential random variables can be used to simulate Poisson random variables with parameter λ. [3 marks] (f ) Consider positive numbers λ1, λ2, . . . , λn and weight factors α1, α2, . . . , αn such that αi ≥ 0 for i = 1, 2, . . . , n and Pn i=1 αi = 1. Show that f(x) = (Pn i=1 αiλie −λix x > 0 0 x ≤ 0 is a density for a random variable and describe a procedure to simulate values from this density.
Intermediate Accounting
ISBN: 978-0324300987
10th Edition
Authors: Loren A Nikolai, D. Bazley and Jefferson P. Jones