Suppose a "psychic" is being tested to determine if she is really psychic. A person in another room concentrates on one of five colored cards, and the psychic is asked to identify the color. Assume that the person is not psychic and is guessing on each trial. Define a success as "psychic identifies correct color". (a) What is p, the probability of success on a single trial? (show 1 decimal place) (b) If we conduct 10 trials, what is the probability that the psychic guesses zero or one of the colors correctly? (show 2 decimal places) (c) What is the mean or expected value of X, the number of correct answers out of 10 trials?
In: Math
2. Alice and 10 other users are sending packets using the pure ALOHA protocol. The duration of a packet is 40 msec. Each user sends a packet (including both originals and retransmissions) following a Poisson process with rate 1/400 packets/msec. (a) What is the chance of success on Alice’ first attempt? (hint: the probability that there is no othertransmission within the vulnerable period of Alice’s attempt) (b) What is the probability that Alice gets exactly k collisions and then a success? (hint: consider a Bernoulli trials process) (c) What is the expected number of transmission attempts needed to successfully send a packet?
In: Computer Science
1. Find the probabilities f(0), f(1), f(2), f(3), and f(4) of a binomial distribution. Keep 4 decimal places in your answer. Use n=4 and p=0.15. 2. Keep 4 decimal places in your answer. About 75% of dog owners buy holiday presents for their dogs. Suppose n=4 dog owners are randomly selected.
2. Find the probability that
a. at least one buys their dog holiday presents
b. three or more buy their dog holiday presents
c. at most three buy their dog holiday presents
d. find the expected number of persons, in the sample, who buy their dog holiday presents.
e. find the standard deviation of persons, in the sample, who buy their dog holiday presents.
3. According to a recent report of the American Medical Association 9.0% of practicing physicians are in the specialty are of family practice. Assuming that the same rate prevails, find the mean and standard deviation of the number of physicians specializing in family practice out of a current random selection of 545 medical graduates.
4. A drug, which is effective in reducing blood pleasure 73% of the time is administered to 10 patients selected at random.
What is the probability that exactly 6 patients have reduced blood pleasure?
What is the probability that at most 9 patients have reduced blood pleasure?
What is the probability that more than 1 patient have reduced blood pleasure?
In: Statistics and Probability
2. (a) Consider an insurer that offers 2 types of policy: home
insurance and car insurance.
20% of all customers have a home insurance policy, and 92% of all
customers have
a car insurance policy. Every customer has at least one of the two
types of policies.
Calculate the probability that a randomly selected customer
(i) has home insurance, given that he has car insurance, (3)
(ii) does not have car insurance, given that he has home insurance.
(3)
(b) Consider the number of days to maturity of 10 short-term
investments below:
85 77 88 78 65 78 57 81 36 90
(i) Make a stem-and-leaf plot for the days-to-maturity data.
(3)
(ii) Hence, or otherwise, compute the interquartile range of the
data. (4)
(iii) Are there any outliers in the data. (3)
(c) An insurance company has a portfolio of 12,000 policies. Based
on past data, the
company estimates that the probability of a claim on any one policy
in a year is
0.0045. It assumes no policy will generate more than one claim in a
year.
(i) Determine the approximate probability of more than 64 claims
from the portfolio of 12,000 policies in a year. (5)
(ii) Determine an approximate equal-tailed interval into which the
number of claims
per year will fall with probability 0.95. (2)
(iii) In practice 70 claims were received in a particular year. A
Director of the company complains about the range of estimates in
part (ii) being wrong. Comment
on the Director’s complaint.
In: Statistics and Probability
This probability question from my physics class is confusing me, any explanation really appreciated!
An analogy: a child with blocks and constraints on physical systems. A certain child's room is partitioned into 100 squares. His toy box in the corner is exactly one square in size and contains some number of blocks. When he plays with the toys, he tends to throw them around and evenly scatter them about the room.
a) Assume that there are now three blocks (red, green, and blue). Also assume that all three blocks can fit on one square. How many accessible states are there for this system, if they are all in the toy box, lid is closed, and the lid is locked in the closed position? (All the other constraints imposed in the story still apply.)
b) What is the total number of accessible microstates for this system, if the toy -box lid is opened?
c) If the boy plays for a long time with all the blocks (and randomly leaves them in the toy box or on one of the floor squares), what is the probability of finding the red block in the toy box, the blue box on square #15, and the green block on square #75? Explain how you determined this result.
d) Again, after a long time, what is the probability of finding the red block in the toy box independently of where the blue and green blocks are?
e) How would probability in (d) change if we asked for it after the boy had been playing for only 15 seconds? Explain why.
f) Explain what condition must be satisfied to say that a system is equally likely to be in any of its accessible microstates.
In: Statistics and Probability
A recent Pew Center Research survey revealed that 68% of high
school students have used tobacco related products. Suppose a
statistician randomly selected 20 high school students. Use this
information to answer questions 39-41.
For a self check out at the local Walmart, the mean number of customers per 5 minute interval is 1.5 customers. Use this information to answer questions 42 and 43.
Assuming the grades on the first homework are nearly normal with
N(90, 4.3), what proportion of grades fall between 85 and 90?
Assuming the grades on the final exam are nearly normal with N(90,
4.3), for a grade of 95 or more on the exam, find the z-score and
explain what it means.
Assuming the grades on the final exam are nearly normal with N(90,
4.3), what is the minimum grade putting you in the top 15% of the
class?
Assuming the grades on the final exam are nearly normal with N(82,
3.86), what proportion of grades fall between 85 and 90?
In: Math
Skills needed to complete this assignment: linked lists, stacks.
Postfix notation, is a mathematical notation in which operators follow their operands; for instance, to add 3 and 4, one would write 3 4 + rather than 3 + 4 (infix notation). If there are multiple operations, operators are given immediately after their second operands; so, the expression written 3 − 4 + 5 in conventional notation would be written 3 4 − 5 + in postfix notation: 4 is first subtracted from 3, then 5 is added to it. An advantage of postfix notation is that it removes the need for parentheses that are required by infix notation. While 3 − 4 × 5 can also be written 3 − (4 × 5), which is different from (3 − 4) × 5. In postfix notation, the former could be written 3 4 5 × −, while the latter could be written 3 4 − 5 × or 5 3 4 − ×.
Stacks can be used to evaluate expressions in postfix notations by following these steps: • If a number is typed, push it on the stack. • If an operation is typed, depending on the operation, pop off two numbers from the stack, perform the operation, and push the result back on the stack. You should complete the Stack class and other functions in the template file (found on Carmen) so that when the user enters an expression in postfix notation, the program calculates and shows the result. In this assignment the user enters one-digit positive numbers only, but the result can be any integer. Only basic operations (i.e. +, -, /, *) are entered by the user and integer division is used in calculations. User input ends with a semicolon.
Class Stack uses a linked list to implement a stack, and it has five public member functions:
• Default constructor: initializes the stack to an empty stack • isEmpty: returns true if the stack is empty and false otherwise
• push: pushes a new number to the top of stack
• pop: removes the top of stack
• top: returns the value at the top of stack, does not remove it from stack
You must use the template file and only add you code were you see /*your code here*/. Do not modify other parts of the code. Do not use C/C++ libraries other than iostream and cstdlib.
template code
#include <iostream>
#include <cstdlib>
using namespace std;
const char SENTINEL = ';';
struct Node {
int data;
Node *link;
};
// precondition: c is initialized
// postcondition: returns true if c is '+', '-', '*' or '/'
bool isOperator(char c);
// precondition: o1 and o2 are initialized and op is an
operator
// postcondition: returns op(o1, o2), e.g. if op is '-' then
returns o1-o2
int calculate(int o1, int o2, char op);
// precondition: c is a digit
// postcondition: returns the integer value of c
int charToInt(char c);
class Stack {
public:
// default constructor
// initializes the stack to an empty stack
Stack();
// this is a const function, meaning it cannot change any of the
member variables
// returns true if the stack is empty, false otherwise
bool isEmpty() const;
// this is a const function, meaning it cannot change any of the
member variables
// returns the value at the top of stack, does not modify the
stack, does not check if the stack is empty or not
int top() const;
// adds data to the top of stack
void push(int data);
// removes the top value of stack, does not return it, does
nothing if the stack is empty
void pop();
private:
Node *listHead; // pointer to the head of a linked list
};
int main() {
char in;
Stack operandStack;
cout << "Enter a postfix expression (ending with "
<< SENTINEL << " and press Enter):\n";
cin >> in ;
while ( in != SENTINEL) {
if (isOperator( in )) {
// pop two numbers from stack
int n1, n2;
if (operandStack.isEmpty()) {
// pring error message
/*your code here*/
exit(1);
}
n2 = operandStack.top();
operandStack.pop();
if (operandStack.isEmpty()) {
// pring error message
/*your code here*/
exit(1);
}
n1 = operandStack.top();
operandStack.pop();
// push the result of calculation to the top of
operandStack
/*your code here*/
} else {
// push the number to the top of opernadStack
/*your code here*/
}
cin >> in ;
}
// pop a number from the top of stack
int result;
result = operandStack.top();
operandStack.pop();
if (operandStack.isEmpty()) // nothing left in the stack
cout << "\nThe result is: " << result <<
endl;
else // there are still numbers in the stack
{
// pring an error message
/*your code here*/
}
return 0;
}
Stack::Stack() {
/*your code here*/
}
bool Stack::isEmpty() const {
/*your code here*/
}
int Stack::top() const {
/*your code here*/
}
void Stack::pop() {
/*your code here*/
}
void Stack::push(int data) {
/*your code here*/
}
int calculate(int o1, int o2, char op) {
/*your code here*/
}
bool isOperator(char c) {
return c == '+' || c == '-' || c == '*' || c == '/';
}
int charToInt(char c) {
return (static_cast<int>(c) -
static_cast<int>('0'));}
In: Computer Science
In java the parts listed as todo in linkedsetwithlinkedbad
Implement all the methods defined as skeletons in the LinkedSetWithLinkedBag class. The class implements the SetInterface (described in Segment 1.21 of chapter 1). It utilizes LinkedBag as defined in the UML diagram below: the instance variable setOfEntries is to be an object of LinkedBag. Test your class with the test cases provided in main. Do not make any changes to provided classes other than LinkedSetWithLinkedBag.
Similar to Lab02, most of the methods can be implemented by simply calling appropriate methods from the LinkedBag, for example the clear method would be implemented as:
public void clear()
{
this.setOfEntries.clear();
}
Ensure that the add method does not allow duplicates and null entries.
public class LinkedSetWithLinkedBag<T extends Comparable<? super T>> implements SetInterface<T>
{
private LinkedBag setOfEntries;
/**
* Creates a set from a new, empty linked bag.
*/
public LinkedSetWithLinkedBag()
{
this.setOfEntries = new LinkedBag<>();
//TODO Project1
} // end default constructor
public boolean add(T newEntry)
{
//TODO Project1
return false; //THIS IS A STUB
} // end add
public T[] toArray()
{
//TODO Project1
return null; //THIS IS A STUB
} // end toArray
public boolean isEmpty()
{
//TODO Project1
return false; //THIS IS A STUB
} // end isEmpty
public boolean contains(T anEntry)
{
//TODO Project1
return false; //THIS IS A STUB
} // end contains
public void clear()
{
//TODO Project1
} // end clear
public T remove()
{
//TODO Project1
return null; //THIS IS A STUB
} // end remove
public boolean removeElement(T anEntry)
{
//TODO Project1
return false; //THIS IS A STUB
} // end remove
// Displays a set.
public void displaySet()
{
//TODO Project1
} // end displaySet
public class LinkedBag
{
private Node firstNode; // reference to first node
public LinkedBag()
{
this.firstNode = null;
} // end default constructor
/**
* Adds a new entry to this bag.
*
* @param newEntry the object to be added as a new entry
* @return true
*/
public boolean add(T newEntry) // OutOfMemoryError possible
{
// add to beginning of chain:
Node newNode = new Node<>(newEntry);
newNode.next = this.firstNode; // make new node reference rest of chain
// (firstNode is null if chain is empty)
this.firstNode = newNode; // new node is at beginning of chain
return true;
} // end add
/**
* Retrieves all entries that are in this bag.
*
* @return a newly allocated array of all the entries in the bag
*/
public T[] toArray()
{
// the cast is safe because the new array contains null entries
int counter = 0;
Node currentNode = this.firstNode;
while (currentNode != null)
{
counter++;
currentNode = currentNode.next;
}
T[] result = (T[]) new Comparable[counter]; // unchecked cast
int index = 0;
currentNode = this.firstNode;
while ((index < result.length) && (currentNode != null))
{
result[index] = currentNode.data;
index++;
currentNode = currentNode.next;
}
return result;
} // end toArray
/**
* Sees whether this bag is empty.
*
* @return true if the bag is empty, or false if not
*/
public boolean isEmpty()
{
return this.firstNode == null;
} // end isEmpty
/**
* Gets the number of entries currently in this bag.
*
* @return the integer number of entries currently in the bag
*/
public int getCurrentSize()
{
throw new UnsupportedOperationException();
} // end getCurrentSize
/**
* Counts the number of times a given entry appears in this bag.
*
* @param anEntry the entry to be counted
* @return the number of times anEntry appears in the bag
*/
public int getFrequencyOf(T anEntry)
{
int frequency = 0;
Node currentNode = this.firstNode;
while (currentNode != null)
{
if (anEntry.equals(currentNode.data))
{
frequency++;
}
currentNode = currentNode.next;
}
return frequency;
} // end getFrequencyOf
/**
* Tests whether this bag contains a given entry.
*
* @param anEntry the entry to locate
* @return true if the bag contains anEntry, or false otherwise
*/
public boolean contains(T anEntry)
{
return getReferenceTo(anEntry) != null;
} // end contains
// Locates a given entry within this bag.
// Returns a reference to the node containing the entry, if located,
// or null otherwise.
private Node getReferenceTo(T anEntry)
{
boolean found = false;
Node currentNode = this.firstNode;
while (!found && (currentNode != null))
{
if (anEntry.equals(currentNode.data))
found = true;
else
currentNode = currentNode.next;
}
return currentNode;
} // end getReferenceTo
/**
* Removes all entries from this bag.
*/
public void clear()
{
while (!isEmpty())
remove();
} // end clear
/**
* Removes one unspecified entry from this bag, if possible.
*
* @return either the removed entry, if the removal
* was successful, or null
*/
public T remove()
{
T result = null;
if (this.firstNode != null)
{
result = this.firstNode.data;
this.firstNode = this.firstNode.next; // remove first node from chain
}
return result;
} // end remove
/**
* Removes one occurrence of a given entry from this bag, if possible.
*
* @param anElement the entry to be removed
* @return true if the removal was successful, or false otherwise
*/
public boolean removeElement(T anElement)
{
boolean result = false;
Node nodeN = getReferenceTo(anElement);
if (nodeN != null)
{
nodeN.data = this.firstNode.data; // replace located entry with entry in first node
this.firstNode = this.firstNode.next; // remove first node from chain
result = true;
}
return result;
} // end remove
private class Node
{
private S data; // entry in bag
private Node next; // link to next node
private Node(S dataPortion)
{
this(dataPortion, null);
} // end constructor
private Node(S dataPortion, Node nextNode)
{
this.data = dataPortion;
this.next = nextNode;
}
} // end Node
} // end LinkedBag
In: Computer Science
Booked Solid, a small independent bookstore in Bradford is trying to decide whether to discontinue selling magazines. The owner suspects that only 7% of the customers buy a magazine and thinks that she might be able to use the display space to sell something more profitable. Before making a final decision, she decides that for one day he'll keep track of the number of customers and whether or not they buy a magazine.
In: Statistics and Probability
On February 27, 2013, the City Council of Cincinnati (OH) passed an ordinance requiring photoelectric smoke detectors in all rental properties. However, over 5 years later, the city’s fire department representatives are concerned that not all properties are adhering to the ordinance. Suppose the population proportion of rental properties in Cincinnati having photoelectric smoke detectors is 0.80 (i.e., 80 percent).
(a) If a sample of 6 rental properties is selected at random, what is the probability at least 5 properties have photoelectric smoke detectors installed?
(b) What three Bernoulli trial assumptions did you make in performing the calculation in part (a)?
(c) Instead of sampling a fixed number of rental properties, suppose rental properties were inspected until the third one without photoelectric smoke detectors was found. Under the assumptions outlined in part (b), please write the distribution of the number of rental properties that would be inspected. Graph the side by side pdf and cdf plots to present the distribution with proper subtitles.
(d) Calculate the probability that the number of rental properties inspected exceeds 10 until the third one was found without photoelectric smoke detectors.
In: Statistics and Probability