Questions
Roulette is a casino game that involves spinning a ball on a wheel that is marked...

Roulette is a casino game that involves spinning a ball on a wheel that is marked with numbered squares that are red, black or green. Half of the numbers 1-36 are colored red and half are black. The numbers 0 and 00 are green. Each number occurs only once on the wheel.

We can make many different types of bets but the simplest are to bet on a number or on a color (either red or black). These are the only two we will consider. After all the players place their bets, the wheel is spun and the ball will land on a particular number and color.
We begin by placing a bet on a number between 1 and 36. This bet pays 36 to 1 in most casinos, which means that you will be paid $36 for each $1 you bet on the winning number. If you lose, you simply lose whatever amount you bet.

1. Calculate the probability that you will win on a single spin of the wheel.
2. Calculate the probability that you will lose on a single spin of the wheel.
3. If you bet $8 on the winning number, how much money will you win? What is the expected value of a bet on a single number if you bet $1. What if you bet 5 dollars? What if you bet 10 dollars? Do you see a pattern? Explain?



In: Statistics and Probability

Let’s assume there is 1 fake coin out of 1000 coins. ( P[Coin=fake] = 0.001 )...

Let’s assume there is 1 fake coin out of 1000 coins. ( P[Coin=fake] = 0.001 ) The probability of showing head for fake coin is 0.9 (P[Head | Coin=fake] = 0.9). For normal coin, the probability of showing head is 0.5 (P[Head | Coin=normal] = 0.5).

i.  Bayes theorem, If you have a coin, and toss it one time. You got a head. What is the probability that this coin is fake?

ii. If you toss a coin 10 times, you got 8 head out of ten tosses. What is the probability of this event if the coin is fair (P[X=8|Coin=normal], X is a random variable representing number of head out of ten tosses)? What is the probability of this event if the coin is fake( P[X=8|Coin=fake])?

iii.   If you toss a coin 10 times, you got 8 head out of ten tosses. What is the probability that this coin is fake?

iv. Calculate the probability that you will get a head after you get 8 head out of ten tosses? What is the probability if you are Frequentist? What is it if you are Bayesian?

In: Statistics and Probability

GRADED PROBLEM SET #5 Answer each of the following questions completely. There are a total of...

GRADED PROBLEM SET #5

Answer each of the following questions completely. There are a total of 20 points possible in the assignment.

  1. (8 pts) Based on past results found in the Information Please Almanac there is a 0.1919 probability that a baseball World Series will last four games, a 0.2121 probability that it will last five games, a 0.2223 probability that it will last six games, and a 0.3737 probability that it will last seven games.
    1. Does the given information describe a probability distribution? Explain.

  1. Assuming that the given information describes a probability distribution, find the mean and standard deviation for the number of games in World Series.

  1. (4 pts) Men heights are normally distributed with a mean of 70 inches and a standard deviation of 3 inches. Doorframes have to be designed so that 99.9% of all men can pass under without stooping. What is the height of the doorframe?

  1. (8 pts) Tree diameters in a plot of land are normally distributed with a mean of 14 inches and a standard deviation of 3.2 inches.
    1. What is the probability that an individual tree has a diameter between 13 inches and 16.3 inches?

  1. What is the probability that an individual tree has a diameter less than 12 inches?

  1. What is the probability that an individual tree has a diameter of at least 15 inches?

  1. Find the cutoff for the 80th percentile of tree diameters. (Provide the probability notation)

In: Math

Implement the SimpleQueue interface with the MyQueue class. You can use either a linked list or...

Implement the SimpleQueue interface with the MyQueue class. You can use either a linked list or a dynamic array to implement the data structure.

A queue is a specialised form of list in which you can only get and remove the first element in the queue.

The class should be able to work with the following code:

SimpleQueue queue = new MyQueue();

NB: You cannot import anything from the standard library for this task. The data structure must be of your own creation, not a modified form of a pre-existing class.

-----------------------------------------------------------

public interface SimpleQueue {
  

   /**
   * Returns true if the queue is empty, else false.
   *
   * @return   whether the queue is empty
   */
   public boolean isEmpty();

   /**
   * Removes all elements from the queue.
   */
   public void clear();
  

   /**
   * Returns the first element, null if empty.
   *
   * @return   the first element
   */
   public T peek();
  
   /**
   * Returns and removes the first element, null if empty.
   *
   * @return   the first element
   */
   public T dequeue();
  
   /**
   * Appends the element to the end of the queue. Does nothing if the element is null.
   *
   * @param elem   the element to be added
   */
   public void enqueue(T elem);
  

   /**
   * Returns the size of the queue
   *
   * @return   the size of the queue
   */
   public int size();
  

   /**
   * Returns true if the queue contains the given element.
   *
   * @return   whether the element is present
   */
   public boolean contains(T elem);
}

In: Computer Science

In this Java program you will implement your own doubly linked lists. Implement the following operations...

In this Java program you will implement your own doubly linked lists.
Implement the following operations that Java7 LinkedLists have.

1. public DList()
This creates the empty list

2. public void addFirst(String element)
adds the element to the front of the list

3. public void addLast(String element)
adds the element to the end of the list

4. public String getFirst()

5. public String getLast()

6. public String removeLast()
removes & returns the last element of the list.

7. public String removeFirst()
removes & returns the front element of the list.

8. public String get(int index)
Returns the value at “position” index. IndexOutOfBoundsException should be
thrown if the index is non-existent.

9. public String set(int index, String value)
changes the value at “position” index and returns the old value. IndexOutOfBoundsException should be thrown if the index is non-existent.

10. public int indexOf(Object obj)
Returns the index of obj if it is in the list and -1 otherwise.

11. public int size()

12.public boolean contains(Object obj)
Returns true if obj appears in the list and false otherwise.

13. public Iterator iterator()
Returns an iterator over the list. This should be a non static inner class.

In: Computer Science

IN JAVA: Repeat Exercise 28, but add the methods to the LinkedStack class. Add the following...

IN JAVA:

Repeat Exercise 28, but add the methods to the LinkedStack class.

Add the following methods to the LinkedStacked class, and create a test driver for each to show that they work correctly. In order to practice your array related coding skills, code each of these methods by accessing the internal variables of the LinkedStacked, not by calling the previously defined public methods of the class.

- String toString()—creates and returns a string that correctly represents the current stack. Such a method could prove useful for testing and debugging the class and for testing and debugging applications that use the class. Assume each stacked element already provided its own reasonable toString method.

- intsize()—returnsacountofhowmanyitemsarecurrentlyonthestack.Do not add any instance variables to the LinkStacked class in order to implement this method.

- void popSome(int count)—removes the top count elements from the stack; throws StackUnderflowException if there are less than count elements on the stack .

- booleanswapStart()—if there are less than two elements on the stack returns false; otherwise it reverses the order of the top two elements on the stack and returns true.

- T poptop( )—the “classic” pop operation, if the stack is empty it throws StackUnderflowException; otherwise it both removes and returns the top element of the stack.

package ch02.stacks;

import support.LLNode;

public class LinkedStack implements StackInterface
{
protected LLNode top; // reference to the top of this stack

public LinkedStack()
{
top = null;
}

public void push(T element)
// Places element at the top of this stack.
{
LLNode newNode = new LLNode(element);
newNode.setLink(top);
top = newNode;
}

public void pop()
// Throws StackUnderflowException if this stack is empty,
// otherwise removes top element from this stack.
{
if (isEmpty())
throw new StackUnderflowException("Pop attempted on an empty stack.");
else
top = top.getLink();
}

public T top()
// Throws StackUnderflowException if this stack is empty,
// otherwise returns top element of this stack.
{
if (isEmpty())
throw new StackUnderflowException("Top attempted on an empty stack.");
else
return top.getInfo();
}

public boolean isEmpty()
// Returns true if this stack is empty, otherwise returns false.
{
return (top == null);
}

public boolean isFull()
// Returns false - a linked stack is never full
{
return false;
}

}

In: Computer Science

You are provided with a StackInterface to implement your stack, make sure to implement the data...

You are provided with a StackInterface to implement your stack, make sure to implement the data structure using java.util.ArrayList and naming your implementation ArrayListStack (make sure to use generics like you have been for the data structures so far). The provided StackTester assumes you name your implementation that way. Note that you have also been provided a PalindromeTester with the specific isPalindrome() method you are required to implement, following the approach above. The method should take whitespace, case-sensitivity, digits, and symbols into account (see documentation above method).

Additionally, provide your implementation for a CircularArrayQueue<E> based on the java.util.Queue interface, passing the JUnit tests provided for the following six methods.

Queue interface methods to implement:

return type method + description
boolean add(E e)
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions, returning true upon success and throwing an IllegalStateException if no space is currently available.
E element()
Retrieves, but does not remove, the head of this queue.
boolean offer(E e)
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions.
E peek()
Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.
E poll()
Retrieves and removes the head of this queue, or returns null if this queue is empty.
E remove()

Retrieves and removes the head of this queue.

StackInterface.java

public interface StackInterface<E> {

    /**
     * Returns true if the stack is empty; otherwise, returns false
     *
     * @return true if empty, false otherwise
     */
    public boolean empty();

    /**
     * Returns the object at the top of the stack without removing it
     *
     * @return reference (shallow copy) of object at top of stack
     */
    public E peek();

    /**
     * Returns the object at the top of the stack and removes it
     *
     * @return reference of removed object from top of stack
     */
    public E pop();

    /**
     * Pushes an item onto the top of the stack and returns the item pushed.
     *
     * @param obj object to push onto top of stack
     * @return item that was pushed
     */
    public E push(E obj);
}

In: Computer Science

Show your work! 2.   We did a poll of students in a BUS 232 class. The...

Show your work!

2.   We did a poll of students in a BUS 232 class. The students were asked to name their favorite color. The result is shown in Table 2.

Table 2

     Favorite Color

Red

Blue

Purple

Total

Female

2

2

0

4

Male

0

3

1

4

Total

2

5

1

8

Number of E whoarefavorof F

Hint: Conditional Probability Rule: P (F | E) =

Totalnumberof E

Suppose that one student is selected at random from the group. (4 points) What is the probability as a fraction in the simplest form that:

  1. it will be a male? P (male) =
  2. it will be a female who likes red? Hint: This is NOT a conditional probability.
    1. (a female who likes red) =
  3. it will be someone who likes blue given that we know that it is a male?
    1. (someone who likes blue | male) =
  4. it will be someone who likes red given that we know that it is a female?

.

  1. (someone who likes red | female) =

3.   Suppose you roll a fair die three times. What would be the probability of getting ONE three times? Hint: Use the law of large number, which is the theoretical probability. Show the answers as a fraction in the simplest form. (2 point)

P (1 for the first roll, 1 for the second roll and 1 for the third roll roll) =

In: Statistics and Probability

Q1/ A batch of printed circuit cards is populated with semiconductor chips with 25% are defective...

Q1/

A batch of printed circuit cards is populated with semiconductor chips with 25% are defective cards. Five of these are selected randomly for function testing.The random variable X has a binmial distribution.

Find the probability that we get exactly one defective card

0.564

0.395

0.764

0.987

ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

Q2/

A batch of printed circuit cards is populated with semiconductor chips with 45% are defective cards. Five of these are selected randomly for function testing . The random variable X has a binomial distribution

Find the probability that we get at least 5 defectives cards

0.00097

0.0184

0.0033

0.085

ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

Q3/

A batch of printed circuit cards is populated with semiconductor chips with 35% are defective cards. Five of these are selected randomly for function testing. The random variable X has a binomial distribution.

Find the probability that we get less than 5 defective cards

0.199

0.564

0.342

0.994

ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

Q4/

The mean number of typing errors in a document is 6 per page. The random variable X has a Poisson distribution. Find the probability that in a 3 pages chosen at random there are 10 mistakes

0.192

0.352

0.014

0.74

ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

Q5/

The mean number of typing errors in a document is 4 per page. The random variable X has a Poisson distribution. Find the probability that in a 2 pages chosen at random there are more than one mistake

0.6765

0.9996

0.294

0.753

In: Statistics and Probability

7. Suppose the number of photons emitted by an atom during a one-minute time window can...

7. Suppose the number of photons emitted by an atom during a one-minute time window can be modeled as a Poisson random variable with parameter ? = 2. Now, suppose you watch the atom for two minutes, and the number of emitted photons in each minute is an independent Poisson process. Calculate the probability that you see exactly one photon during the two minutes. (Hint: this is the probability that you see no photons in the first minute and one photon in the second minute, plus the probability that you see one photon in the first minute and no photons in the

second minute.) Similarly calculate the probability that you see exactly two photons during the two minutes.

Compare these probabilities to the probabilities that a Poisson random variable with parameter ? = 4 takes the value one, or two. Are they the same?

8. Sketch the PDF and CDF of a continuous random variable that is uniform on [0,2].

9. A line segment of length 1 is cut once at random. What is the probability that the longer piece is more than twice the length of the shorter piece?

10. An atom of Uranium-238 is unstable and will eventually decay (i.e., emit a particle and turn into a different element). Given an atom of Uranium-238, the time elapsed until it decays, in years, is modeled as an Exponential random variable with parameter ? = 0.000000000155. How many years must pass for there to be a 50% chance that the Uranium atom decays?

In: Statistics and Probability